Skip to content

feathersjs-mongoose doesn't support $elemMatch as query. #434

@prescripson

Description

@prescripson

My MongoDB document is like

image

I am trying to replicate that query with feathers-mongoose service find method.

Expected behabiour should be matched count 0, as in the original document the objectId 62ed2315399edd80209a502a only have create in the allow field array.

In MongoDB compass after execute the query the result become No Matchd ( Expected )

image

But, in feathers-mongoose service it returns with single match item. ( unexpected )

 async find(params?: Params | undefined): Promise<any[] | Paginated<any>> {
      return await super.find({query: {manage: {$elemMatch: {_id: new mongoose.Types.ObjectId('62ed2315399edd80209a502a'), allow: 'read'}}}})
  }

Although above code is just for demostration, in real scenario those queries are added by feathers-casl.

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions