Query by multiple ids


How can I query objects by multiple ids.
EF would do something like this: query.Where(x => ids.Contains(x.Id)).
How is this possible in realm with c#?


That’s not possible. You can use the string based query syntax to construct a query like that (although I imagine it’ll be less efficient than what SQL Server has):

var filter = string.Join(ids.Select(id => $"Id == {id}"), " || "));
var filtered = query.Filter(filter);

(haven’t run it so there may be some compilation errors, but the general idea should be clear)


Thanks! I’ll try that.