Why use mongoDB?MongoDB is a popular NoSQL database that is often used because of its scalability and flexibility. It stores data in a JSON-like format called BSON, which allows for a more dynamic and flexible schema. Additionally, MongoDB has built-in support for horizontal scaling using sharding, which allows for very large amounts of data to be distributed across multiple servers. It also has a rich query language, support for secondary indexes, and built-in aggregation capabilities. Overall, MongoDB is a good choice for a wide range of modern applications that need to handle large amounts of unstructured or semi-structured data.Built for the way you work with data In MongoDB, CRUD stands for Create, Read, Update, and Delete operations. These are the basic operations that can be performed on a MongoDB database. Here's a brief overview of how to perform these operations using the Mongoose library in Node.js:MongoDB Atlas' document model enables developers to store data as JSON-like objects that resemble objects in application code. With MongoDB Atlas, use the tools and languages that you prefer. Manage your clusters with MongoDB CLI for Atlas, or IaC tools like Terraform or Cloudformation.Secure from the start
With MongoDB Atlas, your database is secure by default with preconfigured security features built-in. Out of the box, your data is protected with continuous encryption at rest, encryption in transit, sophisticated role-based access management, always-on authentication, network isolation, and more.Access 95+ regions across three cloud providers
With the only multi-cloud database, access 95 regions of availability across AWS, Azure, and Google Cloud. Build in top tier resiliency by deploying the same database simultaneously across multiple regions and clouds. House your databases where your customers are to offer low latency user experiences.In MongoDB, CRUD stands for Create, Read, Update, and Delete operations.These are the basic operations that can be performed on a MongoDB database.Here's a brief overview of how to perform these operations using the Mongoose In MongoDB, CRUD stands for Create, Read, Update, and Delete operations. These are the basic operations that can be performed on a MongoDB database. Here's a brief overview of how to perform these operations using the Mongoose library in Node.js:library in Node.jsCreate OperationRead Operation// Create a new document const myDocument = new MyModel({ name: 'John', age: 30 }); // Save the document to the database myDocument.save((error) => { if (error) { console.log(error); } else { console.log('Document saved.'); } });Update Operation// Find all documents MyModel.find((error, documents) => { if (error) { console.log(error); } else { console.log(documents); } }); // Find a specific document MyModel.findOne({ name: 'John' }, (error, document) => { if (error) { console.log(error); } else { console.log(document); } });// Update a document MyModel.updateOne({ name: 'John' }, { age: 31 }, (error) => { if (error) { console.log(error); } else { console.log('Document updated.'); } });Delete Operation// Delete a document MyModel.deleteOne({ name: 'John' }, (error) => { if (error) { console.log(error); } else { console.log('Document deleted.'); } });
Curd operation in mongo db with source code
January 12, 2023
0
Tags
