The find() Method To query data from MongoDB collection, you need to use MongoDB's find() method. Syntax The basic syntax of find() method is as follows − >db.COLLECTION_NAME.find() find() method will display all the documents in a non-structured way. Example Assume we have created a collection named mycol as − > use sampleDB switched to db sampleDB > db . createCollection ( "mycol" ) { "ok" : 1 } > And inserted 3 documents in it using the insert() method as shown below − > db . mycol . insert ([ { title : "MongoDB Overview" , description : "MongoDB is no SQL database" , by : "tutorials point" , url : "http://www.tutorialspoint.com" , tags : [ "mongodb" , "database" , "NoSQL" ], likes : 100 }, { title : "NoSQL Database" , description : "NoSQL database doesn't have tables" , by : "tutoria...
Comments
Post a Comment