Create Collection in MongoDB
db.createCollection(name, options) is used by MongoDB to create collection.Where name is name of collection to be created and Options is a document which is use to specify Name parameter is string...
View ArticleDrop Collection in MongoDB
Syntax:Db.collection-Name.drop();Example:>use mydbswitched to db mydb>show collectionsmycolmycollection> Now drop collection by name,>db.mycollection.drop()true> Again check the...
View ArticleData types in MongoDB
Many data-types support to MongoDB whose list is given below:String : Most common used data-type to store the data. String in mongodb must be UTF-8 valid.Integer : Use to store a numerical value....
View ArticleInsert Document in MongoDB's Collection
We can use insert() or save() methods to insert document(data) in collection MongoDB.Syntax...
View ArticleUpdate document - MongoDB
To update document of MongoDB collection we can use update() and save() methods.1- update()method replace the existing value of existing document in MongoDB collection.2- save() method replace the...
View ArticleQuery Document - MongoDB
THE FIND() METHODTo query data document from collection MongoDB, We need to use MongoDB's find() method.SyntaxBasic syntax of find() method is as follows>db.COLLECTION_NAME.find()When we used find()...
View ArticleDelete Document - MongoDB
remove() method use to remove document from the collection and this method is accepts two parameters. One is deletion criteriaand second is justOne flagDeletion Criteria is deletion criteria it is...
View ArticleProjection in MongoDB
In MongoDB we will use projectionwhen we need to select only necessary data from our data document. If a document has 8 fields and we need to show only 3, then we will select only 3 fields form data...
View ArticleFetch records using limit() and skip() method from MongoDB Collection
limit(): To fetch limited records from MongoDB collection we need to use limit() method. We need to pass number in limit() method as parameter, which number of documents that we want to display.skip():...
View ArticleSort Records in MongoDB
The sort() MethodWe need to use sort()method to sort documents in MongoDB , it accepts a document field along with their sorting order. To specify sorting order 1 and -1 are used. 1 is used for...
View ArticleIndexing in MongoDB
As we know index is technique to arrange data in database which support the efficient resolution of queries. If we run a query to select data, MongoDB do scan every document of collection. Scanning of...
View ArticleMongoDB- Replication
Replication is the process of synchronizing data across multiple servers.Provides redundancy and increases data availability with multiple copies of data of different database servers.It is protects a...
View ArticleMongoDB - Sharding
ShardingSharding is responsible to storing data records across multiple machines. As per demand to manage large amount of data, a single machine is not sufficient to store data nor provide an...
View ArticleMongoDB - Relationships
It's represent how several types of documents are logically related to each other. Relationship can be pattern via embedded and referenced approaches like 1:1, 1: N, N: 1 or N: N.We will consider the...
View ArticleMongoDB 3.0: What's New
MongoDB 3.0 is the newest and most significant release of the world’s fastest growing database. The version radically expands the use cases for MongoDB, allowing you to use it for the vast majority of...
View ArticleCovered Queries in MongoDB
According to mongoDB document overview of index,If your application queries a collection on a particular field or set of fields, then an index on the queried field or a compound index on the set of...
View ArticleAnalyze Query Performance
When we start programming, one thing come in our mind which is performance. There are many factors of performance but query optimization/analyzing and database structure is the more important.In this...
View ArticleWhat is the cursor in mongodb
As we know to fetch records we have to use find()methodin mongodb. db.collection.find() method is the primary method for read operation. This method queries a collection and returns a cursor to the...
View ArticleIndexing Limitations in MongoDB
This limitation regards to MongoDB version 2.6 and above.1- As we know, that the indexes are stored in RAM, we should make sure that the index size does not exceed the RAM limit. If index size...
View ArticleLike in MongoDB Query
In SQL, 'LIKE' query look like as belowSELECT*FROM[dbo.][USERS]WHEREFNAMELIKE'%DILIP%'In MongoDB it's look like as below(query in MongoDB console)db.USERS.find({"FNAME":/DILIP/})Same...
View Article