lucasrochagit / nest-mongo-query-parser

A MongoDB query string parser to be used in applications developed with NestJS.
Apache License 2.0
12 stars 8 forks source link

AND/OR Operation with string regex #3

Closed mitinoh closed 2 years ago

mitinoh commented 2 years ago

I'm trying to do something like this: http://localhost:3000/api/location?name=*firstname*,*secondname but it's now working, another thing, how can i say "accept any value" ex: http://localhost:3000/api/location?name=firstname*,anyvalue

Thank you

lucasrochagit commented 2 years ago

Hello @mitinoh, sorry by delay to answer you.

Regarding the first observation, there is probably a bug when performing filter parsing in AND/OR operations. I will check and upload a fix.

On the second observation, I haven't implemented this "accept any value" feature yet. This library is still in an early stage. But I really liked your suggestion of anyvalue and I can add this feature in library ASAP.

mitinoh commented 2 years ago

I have another question, if i have an array of objects like "questions": [ { "questionName": " . . . ", "answer": " . . . " } ]

Is it possible to filter by questionName? I really love this lib, if you can help me to run it i would be happy to help you fixing the bugs and improving it.

lucasrochagit commented 2 years ago

This type of filter is done with $elemMatch, and currently the library does not support this operator, as it is a bit advanced. But it can be implemented too.

I'm glad this library is useful to you. And feel free to add new features or make corrections, just open a PR. I will be very happy to receive help and make the library more and more complete :)