Comments (5)
Is there anyway to get the updated doc passed back in the callback of an upsert?
All I see is (err) being passed back.
from mongojs.
Pretty sure it supports it, but you have to pass {upsert: true}
instead of just true
.
Here's an example:
var foo = db.collection('foo');
foo.update({_id: 123}, {$inc: {count: 1}}, {upsert: true}, function(err) {});
from mongojs.
Thank you for your comment. And it works after I use {upsert: true}
instead.
Since I think I am still a newbie about mongodb, could you tell me where I can get such information about what the parameters should be and what format they should be in.
Is it included in the documents of mongodb or I need to read the source of mongojs?
from mongojs.
The "Little MongoDB Book" is an awesome starting point: http://openmymind.net/mongodb.pdf
MongoJS is just a thin layer over the core driver to make things easier, so pretty much whatever is true for the MongoDB shell is the same for MongoJS (actually more than the mongodb native driver).
from mongojs.
Thank you very much. I will read it.
I also did some research about mongo db driver and I think MongoJS is the simplest one and easiest to use. Thank you for the great tool.
The problem is solved, so let me close the issue.
from mongojs.
Related Issues (20)
- Use native Object.assign instead of xtend HOT 1
- update `var` to `const` - Readme
- How to use collation HOT 2
- updateMany returns an error HOT 1
- Comparison with the official mongodb package
- Is $text supported within find()? HOT 1
- SCRAM-SHA-256 (and more)
- Publish version with mongodb ^3 HOT 3
- how to set remote connection to mongodb HOT 3
- How do i show dbs, similar to shell "show dbs" HOT 1
- Using replicaSet and readPreference option HOT 1
- "failed to connect to server" even after mongodb is back up HOT 1
- Compatible with hapijs 18? HOT 2
- MongoDB Atlas's URI does not work HOT 5
- collection.update no longer usable for overwriting an entry HOT 16
- v2.6.0 up to v3.1.0 update operation error! HOT 5
- .findOne() query just returns undefined on callback HOT 2
- Does this support aws document db?
- Found Vulnerability 'Regular Expression Denial of Service (ReDoS)' in Synk.io
- How to connect to mongo atlas?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mongojs.