Skip to content

Commit 61d23c2

Browse files
committed
Modified UpdateMultipleDocuments Primer Example to match changes in the Primer.
1 parent 7ad5cde commit 61d23c2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/MongoDB.Driver.Examples/UpdatePrimer.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,18 +80,19 @@ public async Task UpdateMultipleDocuments()
8080
// @begin: update-multiple-documents
8181
// @code: start
8282
var collection = _database.GetCollection<BsonDocument>("restaurants");
83-
var filter = Builders<BsonDocument>.Filter.Eq("address.zipcode", "10016");
83+
var builder = Builders<BsonDocument>.Filter;
84+
var filter = builder.Eq("address.zipcode", "10016") & builder.Eq("cuisine", "Other");
8485
var update = Builders<BsonDocument>.Update
85-
.Set("borough", "Midtown")
86+
.Set("cuisine", "Category To Be Determined")
8687
.CurrentDate("lastModified");
8788
var result = await collection.UpdateManyAsync(filter, update);
8889
// @code: end
8990

9091
// @results: start
91-
result.MatchedCount.Should().Be(433);
92+
result.MatchedCount.Should().Be(20);
9293
if (result.IsModifiedCountAvailable)
9394
{
94-
result.ModifiedCount.Should().Be(433);
95+
result.ModifiedCount.Should().Be(20);
9596
}
9697
// @results: end
9798

0 commit comments

Comments
 (0)