DrKovalex
DrKovalex

Reputation: 13

Does ObjectBox guarantee the order of an items in a ToMany collection?

The main question is: to create some explicit property in the Bar class like "externalOrder" or not.

I have some external data that must be imported into my test project. Does ObjectBox guarantee the order of an items in a ToMany<> collection after adding them to Box storage and requesting back in any moment of time in code?

class Foo {
  ToMany<Bar> relatedItems;
}

class Bar { ... }

Upvotes: 1

Views: 91

Answers (1)

Uwe - ObjectBox
Uwe - ObjectBox

Reputation: 1327

ObjectBox does not guarantee the order of items in a relation. They should currently be returned ordered by ID, but there is no guarantee this won't change.

Upvotes: 1

Related Questions