On Jun 1, 5:15 pm, Andrew Stone <
andrew.j.ston...@gmail.com> wrote:
> You can use findAndModify and other native functions from within mongoose,
> but it's a little tricky.
>
> You can get the collection from your schema and then call findAndModify on
> that. But you must init the results as mongoose models if you plan to use
> them with mongoose. Something like the following.
>
> var schema = new mongoose.Schema({ ... });
> schema.collection.findAndModify(args, function(error, doc) {
> if (err) return cb(err);
> if (!doc) return cb(null);
> var model = new schema();
> model.init(doc, function(err) {
> if (err) return cb(err);
> return cb(null, model);
> });
>
>
>
>
>
>
>
> })
> On Wed, Jun 1, 2011 at 4:23 PM, Patricio Bruna <
pbr...@gmail.com> wrote:
> > So for now the best would be to use the native driver, or there is a way to
> > call findAndModify from mongoose?
>
> > Patricio Bruna V.
> >
http://www.itlinux.cl
> >
(+56-9) 8899 6618
>