mardi 27 janvier 2015

How to call model.find method synchronously in node / loopback?


I am using a custom model and trying to filter it in a loop using find method. e.g. given below



for i = 0 to n
{
var u = User.find( where { name: 'john'});
}


It doesn't work.


Also, if I use the following



for i = 0 to n
{
User.find( where { name: 'john'}, function(u) {... } );

// How do I call the code for further processing?
}


Is there a way to call find method synchronously ? Please help.


Thanks





Aucun commentaire:

Enregistrer un commentaire