1602 / 1602/railway-pagination

'where' and regex issue

オープン
#6 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
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?

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
coffeescript, javascript
領域
backend
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。