Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to get a saved object in MongoDB?
Let us first create a variable. Following is the query −
> var studentDetails={"StudentFirstName":"Chris","StudentLastName":"Brown","StudentAge":24};
Following is the query to save records using save() −
> db.demo45.save(studentDetails);
WriteResult({ "nInserted" : 1 })
Display all documents from a collection with the help of find() method −
> studentDetails;
This will produce the following output −
{
"StudentFirstName" : "Chris",
"StudentLastName" : "Brown",
"StudentAge" : 24,
"_id" : ObjectId("5e25dab4cfb11e5c34d898ec")
} Advertisements
