Open ju2pom opened 6 years ago
Hi @ju2pom, when you run a Where
method after FindAll()
you are running over Linq2Object (IEnumerable extensions), not by LiteDB.
I’m also dealing with the same problem. I noticed LiteDB doesn't fully support Nullable type.
Ommit HasValue and Value:
Where(x => x.Latitude != null && x.Latitude > 0 && x.Longitude != null && x.Longitude> 0)
or just
Where(x => x.Latitude > 0 && x.Longitude > 0)
Hi @kosorin, try new in v5, please. Also, I made support for HasValue
and Value
properties.
repository.Database.GetCollection<Data>("Collection").FindAll().Where(x => x.Latitude.HasValue && x.Latitude.Value > 0 && x.Longitude.HasValue && x.Longitude.Value > 0)
Returns some valid rowsrepository.Query<Data>("Collection").Include(x => x.Latitude).Include(x => x.Longitude).Where(x => x.Latitude.HasValue && x.Latitude.Value > 0 && x.Longitude.HasValue && x.Longitude.Value > 0)
Returns empty resultLongitude and Latitude are of type
double?
. I'm using LiteDB v4.1.4 Did I misunderstood anything with the repository pattern?