Skip to content

Commit 5f07226

Browse files
committed
Fix
1 parent b81358d commit 5f07226

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

driver-core/src/main/com/mongodb/client/model/expressions/Expressions.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,9 @@ public static ArrayExpression<IntegerExpression> ofIntegerArray(final int... ofI
112112

113113
public static DocumentExpression ofDocument(final Bson document) {
114114
Assertions.notNull("document", document);
115-
// All documents are wrapped in a $literal. It is possible to check
116-
// for empty docs (see https://jira.mongodb.org/browse/SERVER-46422)
117-
// and wrap them, and also to traverse into each document to see if
118-
// it needs to be conditionally wrapped in a $literal, but doing so
119-
// would be brittle and unsafe - we might miss some future case and
120-
// allow an expression where a literal document was expected.
115+
// All documents are wrapped in a $literal. If we don't wrap, we need to
116+
// check for empty documents and documents that are actually expressions
117+
// (and need to be wrapped in $literal anyway). This would be brittle.
121118
return new MqlExpression<>((cr) -> new BsonDocument("$literal",
122119
document.toBsonDocument(BsonDocument.class, cr)));
123120
}

0 commit comments

Comments
 (0)