Loopback.js/Node.js MongoDB - querying against an array -


i have structure looks this:

model: {   "name":"testing",   "details":["detail1","detail2","detail10"] } 

how 1 go finding instances above structure contains instance of detail2 within details property? i've tried:

model.find({where:{details:{elemmatch:{"detail2"}}}},function(err,models){     console.log(models);     console.log(err); }); 

and:

model.find({details:"detail2"},function(err, models){       //throws [error: items must array: "details2"] }); 

from can see (based on comment engineering, https://github.com/strongloop/loopback-datasource-juggler/issues/342#issuecomment-73138705), not possible filter this. need objects , post process. in theory build own remote method , filtering on server aren't doing server-side.


Comments

Popular posts from this blog

Django REST Framework perform_create: You cannot call `.save()` after accessing `serializer.data` -

Why does Go error when trying to marshal this JSON? -