Invece di db.insert()
dovresti usare db.update()
e specifica $upsert: true
.
https://docs.mongodb.com/v3. 2/reference/method/db.collection.update/
Invece di db.insert()
dovresti usare db.update()
e specifica $upsert: true
.
https://docs.mongodb.com/v3. 2/reference/method/db.collection.update/