I have a collection items when i query using a lambda expression with a .ToString() it cause an exception. For example:
var y = items.Find(x => x.Year.ToString() == "1993"); // Year is int
The exception is : "Property 'Year.ToString(' was not mapped into BsonDocument"
Hi @MoamenMohamed, there is not index functions supports. If you want create an index based on a function returns, create a field like this:
public string YearString { get { return this.Year.ToString(); } }
And than use as items.Find(x => x.YearString == "1993")
Thanks, that is exactly what i did.
Just to know, next version will support virtual function field in BsonMapper, some like this:
db.Entity<Customer>().Index("year-fn", (b) => b.Year.ToString());
So, you query will be: items.Find("year-fn", "1993")
That is great, I really love using LiteDB.