Header Ads

The most Essential MongoDB commands for CRUD operations

We all are knowing that MongoDB is NoSQL non-relational database using JSON object to store data in the local server. In the other word, MongoDB is a cross stage, report arranged database. it takes a shot at the idea and reports. accumulation is a gathering of MongoDB records. An accumulation exists inside a solitary database. it has installed reports like RDBMS has the table joins. MongoDB has database,collection,document, field and essential key (default key_id given by MongoDB itself). it's an archive arranged database and gives elite. it's an archive database which is patternless. the single item structure is clear in MongoDB. it doesn't have the perplexing participates in it and it's anything but difficult to scale. we can utilize it in huge and complex information and in client information on the board.

1. Show Database
show dbs

2. Use Database
use DBNAME //use your own database name instead os DBNAME

3. Show Collection
show collections

4. Create new Collection
db.createCollection("cname")

5. to insert data in the table
db.table.insert({"data"})

6. to show table data
db.info.find()

7. to use Where Condition
db.info.find({"where condition"})

8. to use 'greater than' condition
db.info.find({ age: {$lt : 40}})

9.to use 'lower than' condition
db.info.find({ age: {$gt : 20}})

10. to show only the specific data ex 'age'
db.info.find({},{ age : 1})

No comments