1602 / 1602/railway-pagination
'where' and regex issue
- Dominant language
- JavaScript
- Stars
- 9
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
Something is wrong with 'where' when passing regex there, for example:
``` coffeescript
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:
``` javascript
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?
Contributor guide
No contributing guide indexed for this repository
Research direction
Look at the 'where' clause handling in the pagination plugin, likely in the main paginate method. Compare how the regex is passed from CoffeeScript versus hardcoded JavaScript. Check the mongoose adapter integration and see if the regex object is being serialized or passed differently. Run the provided code snippets to reproduce the issue, then trace through the plugin's where processing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- coffeescript
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100