-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
When I execute the following code, I would expect upsertion. However, it looks like no documents are replaced or upserted.
Filter filter = Filters.eq("_id", "Idontexist");
Document newDocument = new Document()
.append("isCheckedOut", false)
.append("borrower", "Brook Reed");
ReplaceOneOptions options = new ReplaceOneOptions().upsert(true);
UpdateResult result = collection.replaceOne(filter, newDocument, options);
System.out.println(result.getMatchedCount());
System.out.println(result.getModifiedCount());
System.out.println(result.getUpsertedId());
prints
0
0
null
Metadata
Metadata
Assignees
Labels
No labels