当前位置:网站首页>If mongoose exists, it will be updated; if it does not exist, it will be added
If mongoose exists, it will be updated; if it does not exist, it will be added
2022-07-28 04:28:00 【itoof.com】
【findOneAndUpdate 】
- Modification of existence , There is no such thing as doing nothing
let mong_result = await this.case_main_keys_mongodb.findOneAndUpdate({
'name': ' Li Si '
}, {
$set: {
' Sequence _1': '333',
}
}, {
})
- Modification of existence , And back to Revised data , There is no such thing as doing nothing
let mong_result = await this.case_main_keys_mongodb.findOneAndUpdate({
'name': ' Li Si '
}, {
$set: {
' Sequence _1': '333',
}
}, {
new: true})
- Modification of existence , If it doesn't exist, add , And back to ( modify or newly added ) Later data ,
let mong_result = await this.case_main_keys_mongodb.findOneAndUpdate({
'name': ' Li Si '
}, {
$set: {
' Sequence _1': '333',
}
}, {
upsert: true, new: true})
Be careful :
$setOnInsert and $set Attribute records in cannot be the same
mongo UPDATE statement using $setOnInsert、$upsert and $set、$upsert The difference between
For the queried records .
Use $set、$upsert If it exists, it will be updated , If it doesn't exist, add
Use $setOnInsert、$upsert There is no operation , If it doesn't exist, add
边栏推荐
- Kotlin——函数
- Shell rental reptile
- RN interface jump description
- Important SQL server functions - string utilities
- 空间复杂度计算超全整理!!(一起手撕复杂度计算
- Difference between on, where and having
- gerrit操作-回退掉某个patch_set
- Kingbasees Security Guide for Jincang database -- 6.1 introduction to strong authentication
- Information system project manager (2022) - key content: organization level project management, process management, project set management (18)
- [735. Planetary collision]
猜你喜欢

Glusterfs file is not mounted, permission: R-S

Virtual machine class loading mechanism

2022-7-27 顾宇佳 学习笔记

glusterfs 文件未挂载,权限: r-s

Information system project manager (2022) - key content: Project Procurement Management (12)

pytorch_ Lightning in lightning_ The output of hparams.yaml in logs is null

Go结构体

Reading of seq2path: generating sentimental tuples as paths of a tree

Important SQL server functions - numeric functions

虚拟机类加载机制
随机推荐
Object locking in relational database transactions
Space complexity calculation super full sorting!! (calculation of hand tearing complexity
Idea2022 change the local warehouse and configure Alibaba cloud central warehouse
23 openwrt switch VLAN configuration
将数据库拿到的数据渲染到elementUI 中的table中去
Remove screen cutting and copying restrictions
[day03] process control statement
【YOLOv5实战5】基于YOLOv5的交通标志识别系统-YOLOv5整合PyQt5
[practice] use the web animations API to realize a clock with accurate timing
MySQL: data types and operators
20-Openwrt crond crontab
虚拟机类加载机制
Zhejiang University and other recent review papers on deep learning new drug design
【sylar】框架篇-Chapter15-Stream 模块
Esp8266 WiFi module and mobile communication
What is the account opening process of qiniu business school? Is it safe?
idea启动项目mvn命令终端用不了法将“mvn”项识别为 cmdlet
Advanced architects, 16 common principles of microservice design and Governance
glusterfs 文件未挂载,权限: r-s
idea2022更改本地仓库,配置阿里云中央仓库