Create or Insert Operation in MongoDB

a) db.collection.insert() - Version 2.6

b) - Version 2.6  

The save() method uses either the insert or the update command. If record already exit the it updates else insert the new document.

c) db.collection.insertOne() - Version 3.2

d) db.collection.insertMany() - Version 3.2


Share This:

What is the use of MongoDB or When to use MongoDB ?

  • MongoDB is mostly used as the primary data store for operational applications with real-time requirements . MongoDB is easy to operate and scale in ways that are hard if not impossible with relational databases.
  • In many use cases where relational databases aren’t a good fit, like applications with unstructured, semi-structured and polymorphic data, as well as applications with large scalability requirements or multi-data center deployments so in that case MongoDB is the best option to choose.
  • MongoDB may not be a good fit for some applications. For example, applications that require complex transactions  and scan-oriented applications that access large subsets of the data most of the time may not be a good fit for MongoDB. MongoDB is not a drop-in replacement for legacy applications built around the relational data model and SQL.
  • Some common use cases include mobile apps, product catalogs, real-time personalization, content management, logging and applications delivering a single view across multiple systems.
  •  ...  Read More

    Share This:

    Node JS with mongoose | Create schema | Save data to mongodb in node js

    To install the mongoose:                                                                    


    MongoDB connection using mongoose with node JS: Write the following code in app.js Create schema for blog post: schema/post.js View : views/post.js

    Download Code

    Share This:

    What is MongoDB?

    What is MongoDB? and Why MongoDB?

    MongoDB is a cross-platform, document oriented database that provides, high performance, high availability, and easy scalability. MongoDB works on concept of collection and document. MongoDB is leading NoSQL database which is written in C++ and stores data in the form JSON.

    Share This:

    How to install mongo db on mac

    1)To install brew

    ruby -e "$(curl -fsSL"

    Or to update brew

    brew update

    2) To install mongodb

    brew install mongodb

    Share This: