开机:mongod --dbpath D:\mongo //mongo是文件夹名字
连接数据库:mongo
删除数据库:db.dropDatabase()
列出所有数据库 show dbs;
使用某个数据库 use 数据库名字
新建数据库 use 数据库名字(当前没有的)
查看当前所在数据库 db
查看数据库都有哪些集合 show collections
查看集合的详细信息 db.student.find():
删除数据库 db.dropDatabase();
创建一个集合 db.createCollection("mycollection")
----------------------------------------------------------------------------------------------------------------
查找数据:
db.student.find({"score.shuxue":70}) //查找数学70分的 “score” 是数据库字段
db.student.find({"score.shuxue":70,“age”:18}) //多个条件
db.student.find({"score.yuwen":{$gt:50}}); //语文成绩大于50的
查询一共多少条数据:db.student.stats();