Search code examples
node.jsloopbackjsstrongloop

Loopback Find is returning Empty


Database : Mongo 3.4+ NodeJS:v6.9.4 OS: Centos 7+

In mongo shell, following command return result,

    db.processticket.find({"parentProcessID": "5978ab9f82c56ec868d0d002"})

however, following code find/findOne returns empty result

 app.models.processticket.findOne({
                where: {"parentProcessID": "5978ab9f82c56ec868d0d002" }
            }, function(err, result) {

Solution

  • You can use strictObjectIDCoercion flag in model definition file. Reference