Today is uki 26th class.
mongodb comments
** db.<collection name>.remove({age:25})
{if will delete all the documents equal to age is 25 }
** db. <collection name>.update({name:"raja"},{$set:{name:"ravi"}})
{update to raja name is changed to ravi}
RDBMS Where Clause Equivalents in MongoDB
To query the document on the basis of some condition, you can use following operations
The aggregate() Method
Syntax
Basic syntax of aggregate() method is as follows:
>db.COLLECTION_NAME.aggregate(AGGREGATE_OPERATION)
OR in MongoDB
Syntax
To query documents based on the OR condition, you need to use $or keyword. Following
is the basic syntax of OR −
AND in MongoDB
Syntax
In the find() method, if you pass multiple keys by separating them by ',' then MongoDB
treats it as AND condition. Following is the basic syntax of AND −
>db.mycol.find({key1:value1, key2:value2}).pretty()
thankyou
No comments:
Post a Comment