Skip to content

Commit

Permalink
Refurbish metadata fields
Browse files Browse the repository at this point in the history
  • Loading branch information
prdoyle committed Nov 13, 2022
1 parent a466994 commit 8091685
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,17 @@ public void refurbish() {
return;
}

// Round trip via state tree nodes
R root = formatter.document2object(newState, rootRef);
doUpdate(replacementDoc(rootRef, root), documentFilter());
BsonValue initialState = formatter.object2bsonValue(root, rootRef.targetType());

// Start with a blank document so subsequent changes become update events instead of inserts
// TODO: should we do this for initialization too? We want those to be updates as well, right?
collection.replaceOne(documentFilter(), new Document());

// Set all the same fields we set on initialization
ensureDocumentExists(initialState, "$set");

session.commitTransaction();
} finally {
if (session.hasActiveTransaction()) {
Expand Down

0 comments on commit 8091685

Please sign in to comment.