Posts
Showing posts with the label MongoDb Introduction
Insert And Find In MongoDb
- Get link
- X
- Other Apps
To insert data into MongoDB collection, you need to use MongoDB's insert() or save()method. Basic syntax of insert() command is as follows: db.COLLECTION_NAME.insert(document) To query data from MongoDB collection, you need to use MongoDB's find() method. Basic syntax of find() method is as follows db.COLLECTION_NAME.find() To display the results in a pretty way, you can use pretty() method. SYNTAX: db.mycol.find().pretty() Apart from find() method there is findOne() method, that reruns only one document.