@@ -167,11 +167,12 @@ func TestCollection_ReplaceTopologyError(t *testing.T) {
167
167
db := c .Database ("TestCollection" )
168
168
coll := db .Collection ("ReplaceTopologyError" )
169
169
170
- doc1 := bson . NewDocument ( bson . EC . Int32 ( "x" , 1 ))
171
- doc2 := bson . NewDocument ( bson . EC . Int32 ( "x" , 6 ))
170
+ doc1 := bsonx. Doc {{ "x" , bsonx . Int32 ( 1 )}}
171
+ doc2 := bsonx. Doc {{ "x" , bsonx . Int32 ( 6 )}}
172
172
docs := []interface {}{doc1 , doc2 }
173
- update := bson .NewDocument (
174
- bson .EC .SubDocumentFromElements ("$inc" , bson .EC .Int32 ("x" , 1 )))
173
+ update := bsonx.Doc {
174
+ {"$inc" , bsonx .Document (bsonx.Doc {{"x" , bsonx .Int32 (1 )}})},
175
+ }
175
176
176
177
_ , err = coll .InsertOne (context .Background (), doc1 )
177
178
require .Equal (t , err , ErrClientDisconnected )
@@ -194,16 +195,20 @@ func TestCollection_ReplaceTopologyError(t *testing.T) {
194
195
_ , err = coll .ReplaceOne (context .Background (), doc1 , doc2 )
195
196
require .Equal (t , err , ErrClientDisconnected )
196
197
197
- pipeline := bson .NewArray (
198
- bson .VC .DocumentFromElements (
199
- bson .EC .SubDocumentFromElements (
200
- "$match" ,
201
- bson .EC .SubDocumentFromElements (
202
- "x" ,
203
- bson .EC .Int32 ("$gte" , 2 ),
204
- ),
205
- ),
206
- ))
198
+ pipeline := bsonx.Arr {
199
+ bsonx .Document (
200
+ bsonx.Doc {{"$match" , bsonx .Document (bsonx.Doc {{"x" , bsonx .Document (bsonx.Doc {{"$gte" , bsonx .Int32 (2 )}})}})}},
201
+ ),
202
+ bsonx .Document (
203
+ bsonx.Doc {{
204
+ "$project" ,
205
+ bsonx .Document (bsonx.Doc {
206
+ {"_id" , bsonx .Int32 (0 )},
207
+ {"x" , bsonx .Int32 (1 )},
208
+ }),
209
+ }},
210
+ )}
211
+
207
212
_ , err = coll .Aggregate (context .Background (), pipeline , options .Aggregate ())
208
213
require .Equal (t , err , ErrClientDisconnected )
209
214
0 commit comments