1602 / 1602/railway-pagination
'where' and regex issue
- 主要语言
- JavaScript
- 星标
- 9
- 派生
- 6
- PR 合并指标
- 30 天内没有已合并 PR
描述
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?
贡献指南
这个仓库没有索引到贡献指南
调研方向
查看分页插件中 'where' 子句的处理,很可能在主要的 paginate 方法中。比较正则表达式从 CoffeeScript 传递的方式与硬编码的 JavaScript 有何不同。检查 mongoose 适配器的集成,查看正则表达式对象是否被序列化或以不同方式传递。运行提供的代码片段以重现问题,然后追踪插件中 where 的处理过程。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- coffeescript
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100