0% found this document useful (0 votes)
13 views2 pages

Mongo

Uploaded by

coderbasher 1122
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views2 pages

Mongo

Uploaded by

coderbasher 1122
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Mongo Db:

db To display database you are using


Use <database> To switch database
Use <New database name> To create a new database, issue the use <db>
command with the database that you would
like to create.
Db.<databasename>.insertOne() To insert one value into the database
Db.<databasename>.insertMany() To insert many values into the database
Db.<database>.find({}) To read documents in the collection
$in The values in the database
$gte Greater than or equals to
$or Or conditiion

 db.collection.updateOne().  To update a single document, use


db.collection.updateOne().
 db.collection.updateMany().  To update multiple documents, use
db.collection.updateMany().

 db.collection.replaceOne().  To replace a document, use


db.collection.replaceOne().

Update:

 The update operation uses $set operation to update the current value.
 To replace the entire content of a document except for the _id field, pass an entirely new
document as the second argument to db.collection.replaceOne().
 When replacing a document, the replacement document must contain only field/value pairs.
Do not include update operators expressions.

Delete:

 To delete multiple documents, use db.collection.deleteMany().


 To delete a single document, use db.collection.deleteOne().
 To delete all the documents in the database db.collection.deleteMany({})

You might also like