findLike() sails waterline query not working

118 views
Skip to first unread message

Bhyri Gayatri

unread,
Oct 1, 2014, 2:59:50 AM10/1/14
to mongod...@googlegroups.com
Hi,
here toFind is an object... my code shown below... its working perfect for find but i need to search a value in my collection so i'm using like but it giving me the error

Contacts.findLike()
    .where(toFind)
    .exec(function(err,list){
      if(err) console.log(err);
      console.log(list);
    });


Error: Criteria must be an object!
==============================================
Proper usage ::
Contacts.findLike([criteria],[options],callback)

How can i fix it... any help or suggestion

Eric

unread,
Oct 1, 2014, 11:21:17 AM10/1/14
to mongod...@googlegroups.com
Hi
the solution is in the error message
instead go findLike()
use findLike([criteria],[options],callback)
or use regex with find()
Contacts.find({"yourfield": /.*whatyouarelookingfor.*/})
Op woensdag 1 oktober 2014 08:59:50 UTC+2 schreef Bhyri Gayatri:
Reply all
Reply to author
Forward
0 new messages