Common commands for robomongo to operate MongoDB database (updating)

1. Delete documents that contain the specified fields:

db.getCollection('collection name').update({'field name':{$exists:true}}, {$unset:{'field name':''}}, {multi:true})

2. Find documents where a field does not exist:

db.getCollection('collection name').find({'field name':{$exists:false}})

3. Multi-field query:

db.getCollection('collection name').find({'field1':{$exists:false},'field2':{$exists:true}}).count()

4. The output is displayed according to the specified sorting:
db.getCollection('collection name').find().sort({"field name":-1}) 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325652957&siteId=291194637