1

I am trying to query directly on mongo using sails native adapter. I am not getting any result inspite of document present in db. Direct Waterline find functions returns documents. However I want to use native find for some other purpose and trying to make it work. Any suggestions? Output of below : null [].

User.native(function(e,collection){
       collection.find({phoneNumber:mPhoneNumber}).toArray(function(e,r){console.log(e,r);});
HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
Spatil
  • 81
  • 4

1 Answers1

1

It worked. Seems orm native does not convert number in string format to integer while querying. Converted mPhoneNumber to Integer using parseInt and it worked.

Here is the updated code User.native(function(e,collection){ collection.find({phoneNumber:parseInt(mPhoneNumber)}).toArray(function(e,r){console.log(e,r);});

Spatil
  • 81
  • 4