I want to be able copy one field to another in a UpdateMany
statement.
Something like this:
var updateDef = MongoDB.Driver.Builders<UserStory>
.Update
.Set(x => x.SemanticId, x => x.Id);
But the current API doesn’t support that.
How can I do something similar with the Csharp driver, i.e., copy a field to another for all documents in the collection? I also need to get an ObjectId generated in a new field.
2
Answers
Can't be done with the correct collection type, from what I've found..
Must use
BsonDocument
:Close to what @jgauffin provided above, but a bit more good looking: