DB Operations

A MongoDB database consists of a set of collections. A collection contains a set of documents and documents contains field-value pairs that hold the data. The operations that can be performed on the data that resides in a MongoDB database can be classified in to two - Read Operations and Write Operations.

Read operations

Read operations queries the data in a single collection without modifying them. In mongo shell this is performed using the find() and findOne() methods of the collection. Read operations also include aggregation operations such as count(), distint(), group(), mapReduce(), aggregate().

Write Operations

Write Operations create or modify data in a collection. The insert() method inserts new documents to a collection. Modifications to existing data is performed using the update() method and deletions are done by calling the remove() method of a collection.

This section explains how to connect to MongoDB using mongo shell and perform the four core database operations, also called the MongoDB CRUD to Create, Read, Update and Delete documents in a collection.

Last Updated: 02-September-2014


Post a comment

Name

Your Comment

Email (We dont publish it)

Comments

Nothing yet..be the first to share wisdom.