These are chat archives for Automattic/mongoose

23rd
Aug 2018
Charles Baker
@czbaker
Aug 23 2018 16:00

Hey, got a question:

I'm working on a small method for a basic Mongoose model whose purpose is to add a token to an array of tokens in my user model. How do you update the current record/object from inside a method? I see that you can access stuff using "this" (fields), but would I just manipulate this.tokens and then call this.save()? I don't see mention of this specific thing in the docs, unless I'm missing something.

Never mind, I just gave it a shot and that is indeed how it works.
:D