Mongodb: Difference between revisions
No edit summary  | 
				|||
| Line 16: | Line 16: | ||
* OR  | * OR  | ||
  {"$or": [{"firstName": "Michael"}, {"firstName": "Tom"}]}  |   {"$or": [{"firstName": "Michael"}, {"firstName": "Tom"}]}  | ||
* To remove all documents that do not have a certain value:  | |||
 db.inventory.remove( { type : { $ne: "food" } } )  | |||
* To remove all documents that do not have a range of values:  | |||
 db.inventory.remove( { type : { $nin: ["Apple", "Mango"] } } )  | |||
Revision as of 14:51, 27 January 2020
Installation
UI tools =
- MongoDB_Admin
 
git clone https://github.com/hatamiarash7/MongoDB_Admin cd MongoDB_Admin npm start &
- Robo 3T
 
~/apps/robo3t/bin/robo3t &
Querying
- OR
 
{"$or": [{"firstName": "Michael"}, {"firstName": "Tom"}]}
- To remove all documents that do not have a certain value:
 
db.inventory.remove( { type : { $ne: "food" } } )
- To remove all documents that do not have a range of values:
 
db.inventory.remove( { type : { $nin: ["Apple", "Mango"] } } )