文章详情页
mongodb - python mongo findAndModify如何限制数量
浏览:197日期:2022-10-13 18:43:10
问题描述
findAndMondify中有个query参数,有个update标签,可是如何限制搜索数量也就是把下面两个语句合一db.xxx.find({name:'xxx',age:3}).limit(10)db.xxx.update({name:'xxx'},{$set:{age:5}},false,true)
问题解答
回答1:findAndModify方法用于将查找和修改放在一个原子操作中,它一次只能操作一条数据。可以参考文档了解具体用法:
sort document Optional. Determines which document the operation modifies if the query selects multiple documents. findAndModify() modifies the first document in the sort order specified by this argument.
相关文章:
1. javascript - h5微信中怎么禁止横屏2. python - 怎么查看网址做的是什么反爬虫3. css - div设置float:left后高度设置自动会无效 ?4. 关docker hub上有些镜像的tag被标记““This image has vulnerabilities””5. node.js - webpack required打包问题6. boot2docker无法启动7. 为什么我ping不通我的docker容器呢???8. docker-compose中volumes的问题9. docker - 各位电脑上有多少个容器啊?容器一多,自己都搞混了,咋办呢?10. nignx - docker内nginx 80端口被占用
排行榜

网公网安备