MongoDB的常用命令汇总(Mongo4.2.8)


当前第2页 返回上一页

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常用命令内容请搜索


打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...