Skip to content

How to make .remove(null) not to return all removed documents #439

Open
@fmoessle

Description

@fmoessle

MongoDB: 4.2.17
feathers-mongoose: 8.5.1
@feathers/feathers: 4.5.15

Hi!

Currently calling .remove(null) on a service returns all removed documents.

// assuming we have a service called "books"
await feathers.service('books').create({ title: 'The Lord of the Rings' })

// this will return [{ title: 'The Lord of the Rings' }]
await feathers.service('books').remove(null)

// this will also return [{ title: 'The Lord of the Rings' }]
await feathers.service('books').remove(null, {
  query: {
    $limit: 0
  }
)

While this is fine for a small number of removed documents, when the number get's higher (in our case 50k+)
things start to get very slow.

Is there a way to avoid this?

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