evitaDB - Fast e-commerce database
logo
page-background

Constant filtering

If you need to retrieve entities by their entity primary keys, or verify that entities with particular primary keys exist in the database, the constant filter constraint is the place to go. Filtering entities by their primary keys is the fastest way to access entities in evitaDB.

Entity primary key in set

argument:int+

a mandatory set of entity primary keys representing the entities to be returned

The constraint limits the list of returned entities by exactly specifying their entity primary keys.

The sample query returns products whose primary keys are declared in the entityPrimaryKeyInSet constraint. The order of the primary keys in the constraint doesn't matter. The returned entities are always returned in ascending order of their primary keys, unless the orderBy clause is used in the query.
If you want the entities to be returned in the exact order of the primary keys used in the argument of the entityPrimaryKeyInSet constraint, use the entityPrimaryKeyInFilter ordering constraint.

Author: Ing. Jan Novotný

Date updated: 26.5.2023

Documentation Source