node.js - Mongoose remove in async.parallel -


I do not quite understand why this does not work:

  Remove async parallel ([SomeStuff.find ({}), some stuff 2.find ({}), remove some stuff 3.find ({}}, remove}, done);   

While it works fine

  remove async.parallel ([function (callback) {SomeStuff.find ({}) Remove (callback)}, Remove Function (callback) {SomeStuff2.find ({}); (callback);}, function (callback) {SomeStuff3.find ({}) Remove (callback);}];   

Is not it practically equal? First throws an error:

  Type error: object # & lt; Object & gt; No method on the query is 'Cast'.     p> 

The problem is that when you pass the function in the same way you lose the function reference. Remove () is a prototype method, so it depends on the value of this is correct when you pass by yourself, by it value is lost now, so it can no longer talk like this.cast () .

Comments

Popular posts from this blog

php - How can I cram 6+31 numeric characters into 22 alphanumeric characters? -

mysql - where clause in inner join query -

java - Why my included JSP file won't get processed correctly? -