feathers
feathers copied to clipboard
$in query with mongoDB - difference between 5.0.23 and 5.0.24
Hello, did anybody recognize a difference between feathers 5.0.23 vs 5.0.24 using $in-query with mongodb-objectIDs?
In v23 a query
app.service('messages').find({
query: {
roomId: {
$in: ['62759ea6b884f9180816bfb1', '62759ea6b884f9180816bfc1']
}
}
})
while roomId is a ObjectIdSchema() in the scheme worked.
In v24 I need to change the messagesQueryProperties manually to
roomId: Type.Union([
// an object with { $in: ObjectId[] }
Type.Partial(
Type.Object({
$in: Type.Array(ObjectIdSchema())
})
),
// an ObjectId by itself
ObjectIdSchema()
])
to get the query work.
NodeJS version: 20.11.0
Operating System: Windows 11
Browser Version: Edge Version 123.0.2420.97 (Offizielles Build) (64-Bit)
Thank you! Martin
I have the same problem with using query ObjectIdShema with $ne.
Logging the query after serviceQueryResolver
- 0.24
_id: { $ne: "65e1df944e6eaf42babb8198", }, - downgrade to 0.23
_id: { $ne: new ObjectId('65e1df944e6eaf42babb8198'), },
I don't know what would've changed here. Whatever it is, it looks like the tests in https://github.com/feathersjs/feathers/blob/dove/packages/mongodb/test/converters.test.ts#L41 didn't catch it.