-
-
Notifications
You must be signed in to change notification settings - Fork 754
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Service adapter operators
property marked as deprecated while still needed to use MongoDB specific operators starting with $
#3431
Comments
I am running into this same issue, is there a workaround? Edit: |
Where do you added those operators ? |
If you're using TS and generating services, you'll have a
|
Found it thanks !
…On Tue, Dec 10, 2024, 4:22 PM Sean Schnell ***@***.***> wrote:
I am running into this same issue, is there a workaround?
Edit: I see, I was able to get it to work adding: operators: ['$regex',
'$options'],
Where do you added those operators ?
If you're using TS and generating services, you'll have a .class.ts file
like I do, and I added it like so:
export const getOptions = (app: Application): MongoDBAdapterOptions => {
return {
paginate: app.get('paginate'),
operators: ['$regex', '$options'],
Model: app
.get('mongodbClient')
.then((db) => db.collection('journals'))
.then((collection) => {
collection.createIndex({ moduleId: 1 })
return collection
}),
multi: ['remove']
}
—
Reply to this email directly, view it on GitHub
<#3431 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABUSN4GOVV7JHXSPPQAHTWL2E4BMPAVCNFSM6AAAAABTLDQNCOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMZSGAYTQNJXHE>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Steps to reproduce
@feathersjs/mongodb
adapter as a datasesource adapter for your projectExpected behavior
As per the latest docs, specifying the operator in the querySchema is sufficient to allow custom operators call, without the need to add the option
operators: ['$regex']
to the service adapter options.The query should return the documents that have a title that match this regex expression.
Actual behavior
Instead we get this error
error: BadRequest: Invalid query parameter $regex
.Only when I add the
operators
option (which is marked as deprecated) it works fine.System configuration
Module versions (especially the part that's not working):
NodeJS version:
Operating System:
The text was updated successfully, but these errors were encountered: