One, the connection
1.mongo mongodb://localhost:27000
2.
Show Databases (DBS)
Use test
3.
Db
Show collections
Second, insert
1.db.proccessedfile.insertone ({fileName: "20170403/3.gz", Processeddate:new isodate (), datanumber:10000, x:10})
2.db.mongodb.insertmany ([{item: "Journal", Qty:25, Tags: ["blank", "red"], size: {h:14, w:21, UoM: "CM"}}, { Item: "Mat", qty:85, Tags: ["Gray"], size: {h:27.9, w:35.5, UoM: "CM"}}, {item: "Mousepad", qty:25, tags:["gel "," blue "], size: {h:19, w:22.85, UoM:" CM "}}])
Third, query
1.
Db.proccessedfile.find ()
Db.proccessedfile.find (). Pretty ()//pretty format, document or Bson.document, class JSON standard format output, based on query can be followed by
2.db.mongodb.find ({item: "Mousepad"})
3.db.mongodb.find ({qty: {$in: [+]}}). Pretty ()//=, followed by a collection of array data, like an OR operation, $or followed by a collection of array collections
4.
Db.mongodb.find ({qty: {$lte:}}). Pretty ()//>=
Db.mongodb.find ({qty: {$lte: $, $gte: +}}). Pretty ()//>=, <=
Db.mongodb.find ({item: "Mousepad", Qty: {$lte: $, $gte: +}). Pretty ()//and operation
MONGODB basic Operating practices--mongodb shell side