File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed
driver-core/src/main/com/mongodb/client/model/expressions Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -112,12 +112,9 @@ public static ArrayExpression<IntegerExpression> ofIntegerArray(final int... ofI
112
112
113
113
public static DocumentExpression ofDocument (final Bson document ) {
114
114
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.
121
118
return new MqlExpression <>((cr ) -> new BsonDocument ("$literal" ,
122
119
document .toBsonDocument (BsonDocument .class , cr )));
123
120
}
You can’t perform that action at this time.
0 commit comments