I have a sails-mongodb query which is
db('insights').find( { $text: { $search: search} } ).limit(limit).skip(offset).exec(function (err, insights) { ... }
which give an error of
{"name":"MongoError","message":"\"$search\" had the wrong type. Expected String, found RegEx","waitedMS":0,"ok":0
The equivalent Mongodb query works.
var col = db.collection('insights');
col.find( { $text: { $search: search } } ).skip(offset).limit(limit).toArray(function(err, items) { .. }
An example value of 'search' is "\"jim\"" where the search term would be { $text: { $search: "\"jim\" }
What is the correct way to pass in a $text : $search object through sails-mongodb?