usmannarshad / mongodb Goto Github PK
View Code? Open in Web Editor NEWHow to connect MongoDB with your application and Get/Post
How to connect MongoDB with your application and Get/Post
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.