What’s the difference between “deletemany” and “remove” in mongodb?

They do the same. The difference is the values that return.

With remove():

> db.ticker.remove({"name": "Bitcoin"})
WriteResult({ "nRemoved" : 2 })

With deleteMany():

> db.ticker.deleteMany({"name": "Bitcoin"})
{ "acknowledged" : true, "deletedCount" : 2 }

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)