Skip to content

Change proposal for over 20x speedup in findManyByIds #84

Open
@gamebak

Description

@gamebak

Speed up proposal for method findManyByIds.

return Promise.all(ids.map(id => methods.findOneById(id, { ttl })))

As-Is right now, it's opening a lot of findOneById with a promise.all, but it's really inefficient once you have over 100 keys and it's slowing the UI.

While I don't exactly know how to implement this in the library exactly, the solution will look similar to this at the mongo level:

 this.collection.find({ _id: { $in: arrIds } })

This will result in a single call to the server-side, speeding up for bigger queries.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions