MongoDB
MongoDB vs. MySQL: What's the difference?
What is MongoDB? MongoDB is a document-oriented NoSQL database used for high volume data storage....
The "insert" command can also be used to insert multiple documents into a collection at one time. The below code example can be used to insert multiple documents at a time.
The following example shows how this can be done,
Step 1) Create a JavaScript variable called myEmployee to hold the array of documents
Step 2) Add the required documents with the Field Name and values to the variable
Step 3) Use the insert command to insert the array of documents into the collection
var myEmployee=
[
{
"Employeeid" : 1,
"EmployeeName" : "Smith"
},
{
"Employeeid" : 2,
"EmployeeName" : "Mohan"
},
{
"Employeeid" : 3,
"EmployeeName" : "Joe"
},
];
db.Employee.insert(myEmployee);
If the command is executed successfully, the following Output will be shown
The output shows that those 3 documents were added to the collection.
JSON is a format called JavaScript Object Notation, and is just a way to store information in an organized, easy-to-read manner. In our further examples, we are going to use the JSON print functionality to see the output in a better format.
Let's look at an example of printing in JSON format
db.Employee.find().forEach(printjson)
Code Explanation:
If the command is executed successfully, the following Output will be shown
Output:
The output clearly shows that all of the documents are printed in JSON style.
What is MongoDB? MongoDB is a document-oriented NoSQL database used for high volume data storage....
The installers for MongoDB are available in both the 32-bit and 64-bit format. The 32-bit...
In MongoDB, the first basic step is to have a database and collection in place. The database is...
{loadposition top-ads-automation-testing-tools} There are many MongoDB management tools available in...
Aggregation basics --> The concept of aggregation is to carry out a computation on the results...
Training Summary MongoDB is a document-oriented NoSQL database used for high volume data storage....