Collection   Leave a comment

Collection is similar to table.

Below are some basic commands for collection related operations:

db.createCollection(“name”): Create the collection.

db.collectionname.insert(“”): Insert the data in collection.

db.collectionname.drop(): Drop the collection.

db.collectionname.find(): Search the record in collection.

db.collectionname.findone(): Top one in collection.

db.collectionname.find().pretty(): Return the formatted data.

show collections: Return all the collections.

db.collectionname.remove(criteria, 1): Delete record.

db.collectionname.save(): Replace the data.

db.collectionname.update(): Update data.

 

 

 

Advertisements

Posted March 11, 2018 by Izharuddin Shaikh in MongoDB

Tagged with

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: