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
I'm using a lot of generics in my application - most documents have a common structure, so my generic bulk update has the document id's and a Dictionary<string, object> as input parameters. I then generate a new entity based on that dictionary, and provide it to UpdateMany.
var myDict = new Dictionary<string, object>
{
{"StringProp", "hello" },
{"BoolProp", true },
{"SubProp.StringProp", "subprop value" },
}
List<string> ids = []; // would contain the ids of the documents to update
TEntity updateEntity = myDict.ToObject<T>(); // implementation omitted
context.GetCollection<TEntity>().UpdateMany(x => updatEntity, u => ids);
if I run this, I get an exception telling me this:
Extend expression must return an anonymous class to be merge with entities. Eg: `col.UpdateMany(x => new { Name = x.Name.ToUpper() }, x => x.Age > 10)
So, how can I generate that anonymous class that UpdateMany requires?
The text was updated successfully, but these errors were encountered:
I'm using a lot of generics in my application - most documents have a common structure, so my generic bulk update has the document id's and a
Dictionary<string, object>
as input parameters. I then generate a new entity based on that dictionary, and provide it toUpdateMany
.if I run this, I get an exception telling me this:
So, how can I generate that anonymous class that UpdateMany requires?
The text was updated successfully, but these errors were encountered: