5.查询name = yxy的记录
> db.student.find({"name":"yxy"}); { "_id" : ObjectId("5eef61f3447efbc4346fbb9b"), "id" : "2", "name" : "yxy" } { "_id" : ObjectId("5ef077145c4ca32ccc787893"), "id" : "2", "name" : "yxy" }
相当于: select * from student where name = “yxy”;
6.插入int32字段类型的数据
db.student.insert({"id":NumberInt(1234567),"name":"hu"});
7、插入int64字段类型数据
db.student.insert({"age":NumberLong(22),"name":"hu"});
8、插入Decimal字段类型数据
db.student.insert({"va":NumberDecimal("22.3"),"name":"hu"});
9、查询语句
db.student.find({}) ???.projection({}) ???.sort({_id:-1}) ???.limit(100)
10、删除(集合)表
db.student.drop();
参考:http://1000zx.cn/article/48217.htm
到此这篇关于MongoDB的常用命令汇总(Mongo4.2.8)的文章就介绍到这了,更多相关MongoDB常用命令内容请搜索