You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
public class MyClass {
public ObjectId Id {get; set;}
public DateTime LastModified {get; set;}
...
}
If I have an index on the LastModified property, how do I query the database for dates after a certain date while ensuring I use the LastModified index rather than a cursor to iterate every record?
options seem to include _liteDb.GetCollection<MyClass>("MyClass").Find(m => m.LastModified > sinceUtc).ToList() or _liteDb.GetCollection<MyClass>("MyClass").Queryable().Where(m => m.LastModified > sinceUtc).ToList() and even creating a string query. Will any or all of these methods use the index for values since (or indeed between) certain dates? Put another way, is the expression parser etc. smart enough to realise only 1 property is being queried, and that property is indexed (and conversely, just apply a cursor if non-indexed or multiple different indexed properties are used in the query/filter)?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Firstly thank you for a great library.
If I have a document like
If I have an index on the
LastModified
property, how do I query the database for dates after a certain date while ensuring I use the LastModified index rather than a cursor to iterate every record?options seem to include
_liteDb.GetCollection<MyClass>("MyClass").Find(m => m.LastModified > sinceUtc).ToList()
or_liteDb.GetCollection<MyClass>("MyClass").Queryable().Where(m => m.LastModified > sinceUtc).ToList()
and even creating a string query. Will any or all of these methods use the index for values since (or indeed between) certain dates? Put another way, is the expression parser etc. smart enough to realise only 1 property is being queried, and that property is indexed (and conversely, just apply a cursor if non-indexed or multiple different indexed properties are used in the query/filter)?Thanks for your help.
Beta Was this translation helpful? Give feedback.
All reactions