Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$in query with mongoDB - difference between 5.0.23 and 5.0.24 #3467

Open
martinfruehmorgen opened this issue Apr 17, 2024 · 2 comments
Open

Comments

@martinfruehmorgen
Copy link

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

@sainf
Copy link

sainf commented Apr 29, 2024

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'), },

@daffl
Copy link
Member

daffl commented May 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants