Search code examples
c#xamarin.formslitedb

LiteDb v5 Query.All() equivalent


What is the BsonExpression equivalent of Query.All() in LiteDb v5?

I'm having trouble finding BsonExpression that translates to 'all results'. I have a helper class that generates Query in LiteDb v4. So I'm trying to port my helper class to be able to work with LiteDb v5. In LiteDb v4, Find method of a LiteCollection accepts Query object, but in v5 it accepts BsonExpression object.

Using FindAll() method is not an option for the purpose of this helper class, since I'm migrating my application from LiteDb v4 to v5.


Solution

  • As a workaround, I'm using Query.Not("_id", null);, which returns a BsonExpression. Since Id field will never be null, this is good enough for now, but I would still like to do things proper way.