new a database
use test;
show database
show dbs;
show current database
db;
delete a database
db.dropDatabase()
create a collection
db.createCollection("movies");
show all collections
show collections;
delete collection
db.movies.drop();
insert data,the parameter must be a object!!!
db.movies.insert({name:'a',price:120});
you can insert many data in one query
db.movies.insert([{name:'b'},{name:'c'}]);
when '_id' key didn't in object,save() method is same as the insert() method
db.movies.save({name:'d'})
find all data
db.movies.find()
pretty data
db.movies.find().pretty();
find one data
db.movies.findOne();
find specify flied data (name equal to a )
db.movies.find({name:'a'});
price less than 100
db.movies.find({price:{$lt:100}})
price less and equal to 100
db.movies.find({price:{$lte:100}})
g than 100
db.movies.find({price:{$gt:100}})
not equal
db.movies.find({price:{$ne:100}})
and
db.movies..find({$and:[{name:'a'},{price:123}]})
or
db.movies.find({$or:[{name:'a'},{price:123}]})
db.movies.find({price:{$gt:100},$or:[{name:'a'},{falg:true}]})