Open livedata opened 11 years ago
Regular expressions in where conditions are deprecated.
On Tue, Sep 4, 2012 at 8:07 PM, livedata notifications@github.com wrote:
Something is wrong with 'where' when passing regex there, for example:
Page.paginate where: title: new RegExp("a")
It will not work - it does not work when i'm trying. BUT, when i'll hardcode the same condition inside of the helper function:
var foo = { title: new RegExp("a") };Model.all({ limit: limit, offset: (page - 1) * limit, order: order, where: foo, function (err, records) {
It works! I was trying to debug it, with console.dir/log and everything was fine in console output, 'foo' looks exactly like 'opts.where':
{ title: /a/ } { title: /a/ }
I have no idea what is going on there, so i'm reporting it as issue ;-)
PS. as You can see i'm using coffeescript in my controllers, and mongoose db adapter, so perhaps it is (in some weird way) related?
— Reply to this email directly or view it on GitHubhttps://github.com/1602/railway-pagination/issues/6.
Thanks, Anatoliy Chakkaev
Hm, these are supported natively by mongodb aren't they? So (as far as i'm using multiple types of databases for my projects) is there any other way to fetch records using 'wildcards'? Something which would work with most of database engines?
Something is wrong with 'where' when passing regex there, for example:
It will not work - it does not work when i'm trying. BUT, when i'll hardcode the same condition inside of the helper function:
It works! I was trying to debug it, with console.dir/log and everything was fine in console output, 'foo' looks exactly like 'opts.where':
I have no idea what is going on there, so i'm reporting it as issue ;-)
PS. as You can see i'm using coffeescript in my controllers, and mongoose db adapter, so perhaps it is (in some weird way) related?