Giter Club home page Giter Club logo

Comments (5)

ralyodio avatar ralyodio commented on May 24, 2024 1

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.

 avatar commented on May 24, 2024

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.

programus avatar programus commented on May 24, 2024

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.

 avatar commented on May 24, 2024

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.

programus avatar programus commented on May 24, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.