当前位置:网站首页>Update and return document in mongodb - update and return document in mongodb
Update and return document in mongodb - update and return document in mongodb
2022-07-03 02:51:00 【Bustling city 】
problem :
I want to get updated documents. I want to get updated files .This is my original code and it successfully updates but doesn't return the document. This is my original code , It updates successfully but does not return documents .
collection.update({ "code": req.body.code },{$set: req.body.updatedFields}, function(err, results) { res.send({error: err, affected: results}); db.close(); });
I used the toArray
function, but this gave the error "Cannot use a writeConcern without a provided callback": I use the toArray
function , But this gives the wrong “ If there is no callback provided , Can't use writeConcern”:
collection.update({ "code": req.body.code },{$set: req.body.updatedFields}).toArray( function(err, results) { res.send({error: err, affected: results}); db.close(); });
Any ideas? Do you have any ideas ?
Solution :
Reference resources : https://stackoom.com/en/question/1fpsD边栏推荐
- 定了,就选它
- Gbase 8C function / stored procedure definition
- JMeter performance test JDBC request (query database to obtain database data) use "suggestions collection"
- Global and Chinese ammonium dimolybdate market in-depth analysis and prospect risk prediction report 2022 Edition
- How to implement append in tensor
- Baidu map - surrounding search
- Super easy to use logzero
- SQL statement
- Kubernetes family container housekeeper pod online Q & A?
- Gbase 8C system table PG_ aggregate
猜你喜欢
HW initial preparation
定了,就选它
你真的懂继电器吗?
Summary of interview project technology stack
[translation] modern application load balancing with centralized control plane
Linear rectification function relu and its variants in deep learning activation function
Add some hard dishes to the interview: how to improve throughput and timeliness in delayed task scenarios!
HW-初始准备
Le processus de connexion mysql avec docker
HTB-Devel
随机推荐
Mathematical statistics -- Sampling and sampling distribution
基于can总线的A2L文件解析(2)
Informatics Olympiad one general question bank 1006 a+b questions
Introduction to cron expression
random shuffle注意
Can netstat still play like this?
一文带你了解 ZigBee
Gbase 8C function / stored procedure definition
左连接,内连接
Concrete CMS vulnerability
面试八股文整理版
Summary of interview project technology stack
xiaodi-笔记
Deep reinforcement learning for intelligent transportation systems: a survey paper reading notes
Add automatic model generation function to hade
random shuffle注意
Gbase 8C system table PG_ constraint
Check log4j problems using stain analysis
为什么会选择框架?选择什么样的框架
Simple understanding of SVG