Hi
I've tried to perform an update of embedded document using new generic syntax, but didn't find any solution (only adding and deleting embedded documents in collections). I meen code like this:
MongoCollection.Update(
Query.And(Query<ReadDto.Concert>.EQ(ev => ev.Id, evnt.AggregateId),
Query<ReadDto.Concert>.ElemMatch(item => item.LineupItems,
builder =>
builder.EQ(
item => item.ArtistId,
evnt.EntityObjectId))),
Update.Set("LineupItems.$.Headliner", evnt.Headliner)
.Set("ChangeDate", evnt.ChangeDate)
.Set("Version", evnt.Version));
Is it possible to construct such update using Update<>? And also it's not clear how to perform an update of embedded document which is single.
- duplicates
-
CSHARP-531 Support the $ positional operator when building a query for updating a collection
- Closed