Ahhh yes that does make a lot of sense, could definitely see OP (or anyone) getting confused if they came across the model.update docs before the document.update ones. Thank *you* for being so exceedingly polite & respectful, you're awesome. :)
On Monday, December 22, 2014 7:47:27 PM UTC-5, Ryan Graham wrote: > > You are correct. I think I distracted myself with the links I provided and > forgot why I pasted them, which was to show the OP where their confusion > likely came from. > > Thanks for calling me on it so the misleading information wasn't left as > the final word. > > ~Ryan > > On Mon, Dec 22, 2014 at 7:09 AM, Zach Rollyson <[email protected] > <javascript:>> wrote: > >> How exactly do you figure it's calling Model.update? Because of the >> stack trace? I think mongoose calls model.update internally, perhaps? I >> just tested, when updating a document without a callback (i.e. I replicated >> his call) the stack includes a call to model.update. I'm pretty sure he is >> calling document.update, and the error is because he has too many >> arguments. >> >> >> >> On Saturday, December 20, 2014 9:40:38 PM UTC-5, Ryan Graham wrote: >> >>> On Fri, Dec 19, 2014 at 10:46 AM, Zach Rollyson <[email protected]> >>> wrote: >>> >>>> Comes from the line "menu.update({name:request.body.name}, menuObject, >>>> {upsert: true}, onUpdate)" >>>> >>>> It's because mongoose update takes three arguments: document, options, >>>> callback. You have object, object, options, callback; thus mongoose >>>> thinks >>>> your options object is the callback. >>>> >>> >>> >>> I nearly replied with a similar response, but then I realized the code >>> is actually calling Model#update >>> <http://mongoosejs.com/docs/api.html#model_Model.update>, not >>> Document#update >>> <http://mongoosejs.com/docs/api.html#document_Document-update>. The >>> former actually does take 4 arguments and from a cursory look it seems the >>> calling code is using it more or less correctly. >>> >>> That said, I agree that changing this to Document#update is probably >>> still the correct solution. >>> >>> ~Ryan >>> -- >>> http://twitter.com/rmgraham >>> >> -- >> Job board: http://jobs.nodejs.org/ >> New group rules: >> https://gist.github.com/othiym23/9886289#file-moderation-policy-md >> Old group rules: >> https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines >> --- >> You received this message because you are subscribed to the Google Groups >> "nodejs" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/nodejs/b66f71da-f526-4b24-a017-14a216b5e6ec%40googlegroups.com >> >> <https://groups.google.com/d/msgid/nodejs/b66f71da-f526-4b24-a017-14a216b5e6ec%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > > > -- > http://twitter.com/rmgraham > -- Job board: http://jobs.nodejs.org/ New group rules: https://gist.github.com/othiym23/9886289#file-moderation-policy-md Old group rules: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nodejs/7cd5bd19-4818-45db-9712-caaebbd48bd8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
