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]> 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].
> 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/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/CAGjmZGx6FwgOd2YQZM%3DB36%2BQ3NT1r-UkXH1C1HoFZPdot%3DOAcg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to