mongodb ---- findAndModify 写法
2024-08-27 06:08:10
db.coll.findAndModify({
query:{x:"ggg"},
update:{$set:{"x":"gggg"}},
fields:{"x":1},
new:true,
upsert:true
})
query:查询语句
update:(和remove必须有一个,也只能存在一个)
fields:需要显示的字段
new:true:返回更新之后的值 false:返回更新前的值
upsert: 查询结果不存在是否新增
最新文章
- Why is applicationhost.config still being added to source control even thought it's in gitignore
- 操作无效:已关闭 Lob。 ERRORCODE=-4470, SQLSTATE=null
- HQL: Hibernate查询语言
- repeater 结合checkbox批量删除
- 利用程序将.jrxml导出为.jasper文件并用PDF显示(2)
- Oracle游标动态赋值
- 优秀的 Android Studio 插件
- 驱动: oops
- Asycn/Await 异步编程初窥
- apache 配置
- vue-axios基本用法
- vue3+typescript引入外部文件
- [Nuget]Nuget命令行工具安装
- Android版本号列表
- windows docker常用命令
- Implicit super constructor Object() is undefined for default constructor. Must define an explicit constructor
- leetcode-algorithms-21 Merge Two Sorted Lists
- JNI由浅入深_6_简单对象的应用
- (转)Dubbo扩展点实现细节
- 【Python】词典