Only basic use of mongodb is documented here, as learning to walk is a prerequisite for running, and clicking on this article means you happen to be a beginner

I- Connects to the mongodb server

Run win+r to open CMD or Shift + right-click the shell window

Run mongod –dbpath databaseURL to start the mongodb service

Execute mongo to connect to the database

Show DBS Displays databases in the current service

Use dbName To switch to a specified database

Show Collections looks at the tables available in the current database

Use chartName Switches to a specified table. If the table does not exist, create a table with Inser, insertOne, or insertMany. The database instance DB is returned after the table is created successfully

< note :mongodb provides multiple similar commands for each operation, but I feel like mastering one of them is enough. >

II- Add (insert)

Db.chartname. insert(json) Inserts one or more pieces of data into the specified table, or accepts an array of objects if multiple

Example:

db.user.insert({

name:”zs”

}) // Insert a row into the user table containing the name field zs

III – removed

Db.chartname. remove(json) // Deletes one or more data in the specified table

Example:

db.chartName.remove({

name:’zs’

} // select * from user where name = zs

IIII – modify

Db.chartname. update(json1,{set:json2}) // Find a row in the table and update it, where json1 is the filter, **set is the update identifier, and json2 is the specified update field

Example:

db.user.update(

{name:’zs’},

{$set:{

name:’ls’

}}

} // select * from user where name = zs

| | | – check

Db.chartname. find(json) // Query the data in the user table according to the given filter criteria

Example:

db.user.find({

name:”ls”

}) // select * from user where name=ls

With that said, basic curd operations are covered, and for more advanced usage, please refer to my next article