These are chat archives for Automattic/mongoose

Oct 2016
Oct 17 2016 04:35 UTC
jobinfo = function(info,cb){
remove : this.remove(Info).exec(cb)

how to judge whether if it sucessed ?

when i use'api/v1/removeJobinfo',test.removeJobinfo)

test.removeJobinfo = function(req,res){
               if (err) throw err;
               if (???????){           // what should i do here???
                             res.json({sucess:true,info:"Sucessed ,and somthing .."});
Paul "Joey" Clark
Oct 17 2016 10:12 UTC

The Mongoose docs for remove() point to Mongo docs, hinting that you will get a WriteResult back @mylamour.

You can check if data.nRemoved > 0 or something like that.

Oct 17 2016 11:19 UTC
thank u very much , i already try dat.nRemoved !=0 , but here still some problems ? i console.log(data), i didn't find nRemoved.but In mongo shell , it will return @joeytwiddle
Oct 17 2016 11:49 UTC
@joeytwiddle we can use data.result.ok == 1 && data.result.n == 0 , and it will be ok .
Ankur sharma
Oct 17 2016 18:18 UTC
can someone help me? I am trying to use in my app and my app crashes all the time
Oct 17 2016 22:36 UTC
I know I've kind of had this discussion here before, but which is "slower" or "faster", an update query performed using $in: large_array or large_array.size separate update calls?
I'm restructuring some code and I want to go with the many individual updates vs just one massive update call
I'm assuming Mongo's thread-pooled so everything will just be queued and processed as it comes