Archive for the ‘Collection’ Tag

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

%d bloggers like this: