ThinkinMonke
HomeBlogsAbout
HomeBlogAbout
    Blog
    MongoDB

    Table of Contents

    MongoDB

    Learn about NOSQL and mongoDB and connection with express.js

    January 20, 2025
    1 min
    Article
    MongoDB
    Technology

    Table of Contents

    SQL vs NoSQL

    • SQL are Relational Databases whereas, NoSQL are non-relational or distributed database. Popular SQL databases
    • MySQL
    • PostgreSQL
    • SQLite

    Popular NoSQL Databases

    • MongoDB
    • Redis
    • Amazon DynamoDB

    MongoDB

    • A popular NoSQL database
    • Datas are stored in the form of key-value pair.

    Inserting :

    • In mongoDB, objects are stored in a collection, To create a collection: db.createCollection("cats")

      • This will create a collection named 'cats'
    • To insert datas(objects) into the mongoDB collection, 2 methods can be used

        1. `db.insertOne({document})`
        2. `db.insertMany({documents})`
      
      • Examples:
    db.insertOne({
    	name : "siamese",
    	gender : "female",
    	age : 3
    	})
    
    db.insertMany([
    {
    name : "Persian",
    gender : "male",
    age : 2
    },
    {
    name : "Russian",
    gender : "male",
    age : 8
    }]
    	)
    

    Finding :

    • In mongoDB, objects inside the collections can be accessed by using the find() method.
    • To find everything in the collection, db.cats.find() -> This results in every documents present in the collection named cats.

    Published on January 20, 2025

    Estimated reading time: 1 minutes

    Share this article:
    Back to all posts

    You Might Also Like

    Backend
    Technology
    2 min

    Backend

    Backend of web development

    Read more
    React.js
    Technology
    1 min

    React.js

    React.js and its features

    Read more
    Python
    Technology
    1 min

    Python

    Learn more about python libraries

    Read more

    Table of Contents