1602 / 1602/railway-pagination
'where' and regex issue
- Lenguaje dominante
- JavaScript
- Estrellas
- 9
- Forks
- 6
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
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?
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Examina el manejo de la cláusula 'where' en el plugin de paginación, probablemente en el método principal 'paginate'. Compara cómo se pasa la expresión regular desde CoffeeScript frente a JavaScript codificado. Verifica la integración del adaptador de mongoose y observa si el objeto de expresión regular se está serializando o pasando de manera diferente. Ejecuta los fragmentos de código proporcionados para reproducir el problema, luego rastrea el procesamiento de 'where' en el plugin.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- coffeescript
- Área
- backend
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 45/100