Database manipulation in MongoDB Basic database queries for MongoDB The remove() Method Syntax: >db.COLLECTION_NAME.remove(DELLETION_CRITTERIA) Example: >db.Employee.remove({'title':'MongoDB Overview'}); Remove Only One Syntax: >db.COLLECTION_NAME.remove(DELETION_CRITERIA,1) And/OR Condition >db.Employee.find({$and:[{"by":"Sudhir"},{"title": "Testing MongoDB Database"}]}) >db.Employee.find({$or:[{"by":"Sudhir"},{"title": "Testing MongoDB Database"}]}) Using AND and OR Together >db.mycol.find({"likes": {$gt:10}, $or: [{"by": "Sudhir"},{"title": "Testing MongoDB Database"}]}) The save() method replaces the existing document with the new document passed in the save() method. Syntax: >db.COLLECTION_NAME.save({_id:ObjectId(),NEW_DATA}) Example: >db.mycol.save( { "_id" : Objec...
Coding Cheatsheets - Learn web development code and tutorials for Software developers which will helps you in project. Get help on JavaScript, PHP, XML, and more.