Some commands mongodb

mongodb is a non-relational database management system (dbms)

Value is stored to key Key: value ( BSON )

Boot command: mongod --dbpath d: / data seen 27017 says that the boot is successful, the window can not be closed.

Mongo then open a window;

show dbs View database

exit out of the database

CRUD operations curd

use + database name, whether it exists or not will not exist will create a success

Increasing the data (a plurality of data increases, the wording js for loop may be employed to increase the number of pieces of data)

. Db name set .insert ({key: value, ........})

show collections

Query data

db. the name of the collection .find ()

db name .find set. ({$ or: [{character: value}, {character: value}]}) // or

db name .find set ({ "age": {$ gt: 15, $ lt: 18}}). // find data lt older than 15 less than 18 <gt> lte <= gte> =

delete data

db. collection name .remove (condition)

change the data

. Db name set .updata ({ "name": "original name"}, {$ set: {key: value}})

db name .updata set ({ "name": "original name"}, {$ set: {key: value}}, true, true). // The first modified true that when there is no data if Add the second is true whether simultaneously modify multiple.

Guess you like

Origin www.cnblogs.com/dongdong1996/p/12096340.html