These are chat archives for Automattic/mongoose

18th
Jan 2016
Emanuele DelBono
@emadb
Jan 18 2016 14:03
Hi all. Is there any particular package to use with moongose to store files in GridFS? I found a few but they are old and refers to 3.X version.
Valeri Karpov
@vkarpov15
Jan 18 2016 14:06
@jrthib document post hooks don't get flow control but yeah it's possible. No docs yet, opened up an issue Automattic/mongoose#3770 .
@emadb gridfs has never really been a focus for mongoose, I don't know of any packages off the top of my head. The mongodb node driver (which mongoose is built on) has a nice streaming API for gridfs written by yours truly though :) http://mongodb.github.io/node-mongodb-native/2.1/reference/gridfs/streaming/
Emanuele DelBono
@emadb
Jan 18 2016 14:14
Oh yeah! :) thx. If I can I will write a plugin ;-)
David Pronk
@davidpronk
Jan 18 2016 16:55
Hi all. I'm trying to figure out if there is a way to keep a reference to a Model so I don't have to call findOneAndUpdate({_id: queueId}) all the time. There is only one model in the current context so there is no need find it every time I want to update it or read from it. Or is this considered bad practice?
Valeri Karpov
@vkarpov15
Jan 18 2016 20:12
@davidpronk just .findOne(); your model, change it a few times, and then call .save()http://mongoosejs.com/docs/documents.html
David Pronk
@davidpronk
Jan 18 2016 20:26
@vkarpov15 My model is created inside an instance of a module which has various methods that require writing to and reading from the model. So I call save() quite often. In other words: It never ends and I do save() calls all the time.
Matthew Bonig
@mbonig
Jan 18 2016 22:12
hey all