Git Product home page Git Product logo

mongodb's Introduction

MongoDB:
MongoDB, a NoSQL database that stores data in JSON-like documents with flexible schemas

Make a project add its users and api then create its cluster or db.
Click connect btn on cluster select connect with application.
Copy  connection string
Replace <password> with the password for the admin user. Ensure any option params are URL encoded.
npm install mongodb
const {MongoCient}=require('mongodb')
To check if u r connected with db use:
MongoCient.connect(connectionstring,(err,client)=>{
if(err)
{
    throw err
}
console.log("Connected to db")
}) 
It is not necessary it just tell u wheter ur query is right or there is some mistake.

Add in DB:
Consider that we have btn of add user that when clicked add the user in MongoDB
first we will connect with db
const client=new MongoClient(URL)
client.connect()
Now there is a order 
Project->Cluester->DB->Collection
Then we will access to db if not present it will create new
const DataBase=client.db('MyDB')
then same for Collection
const collection=DataBase.collection('Users')
Now to add data:
const query=await collection.insertOne({
    name:'Francis',
    lastname:'Jones'
})
and in btn onClick function just write axios.get('link of what u write i server file like api/users')

=>Mongoose:
Mongoose provides a straight-forward, schema-based solution to model your application data. It includes built-in type casting, validation, query building, business logic hooks and more, out of the box.

mongodb's People

Contributors

usmannarshad avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.