@@ -933,6 +933,44 @@ describe('Shell API (integration)', function() {
933
933
} ) ;
934
934
} ) ;
935
935
} ) ;
936
+
937
+ describe ( 'find' , ( ) => {
938
+ it ( 'uses default options for the driver (find)' , async ( ) => {
939
+ const longOne = new serviceProvider . bsonLibrary . Long ( '1' ) ;
940
+ await serviceProvider . insertOne ( dbName , collectionName , { longOne, _id : 0 } ) ;
941
+
942
+ const cursor = await collection . find ( { } ) ;
943
+
944
+ expect ( await cursor . toArray ( ) ) . to . deep . equal ( [ { longOne, _id : 0 } ] ) ;
945
+ } ) ;
946
+
947
+ it ( 'passes through options to the driver (find)' , async ( ) => {
948
+ const longOne = new serviceProvider . bsonLibrary . Long ( '1' ) ;
949
+ await serviceProvider . insertOne ( dbName , collectionName , { longOne, _id : 0 } ) ;
950
+
951
+ const cursor = await collection . find ( { } , { } , { promoteLongs : true } ) ;
952
+
953
+ expect ( await cursor . toArray ( ) ) . to . deep . equal ( [ { longOne : 1 , _id : 0 } ] ) ;
954
+ } ) ;
955
+
956
+ it ( 'uses default options for the driver (findOne)' , async ( ) => {
957
+ const longOne = new serviceProvider . bsonLibrary . Long ( '1' ) ;
958
+ await serviceProvider . insertOne ( dbName , collectionName , { longOne, _id : 0 } ) ;
959
+
960
+ const doc = await collection . findOne ( { } ) ;
961
+
962
+ expect ( doc ) . to . deep . equal ( { longOne, _id : 0 } ) ;
963
+ } ) ;
964
+
965
+ it ( 'passes through options to the driver (findOne)' , async ( ) => {
966
+ const longOne = new serviceProvider . bsonLibrary . Long ( '1' ) ;
967
+ await serviceProvider . insertOne ( dbName , collectionName , { longOne, _id : 0 } ) ;
968
+
969
+ const doc = await collection . findOne ( { } , { } , { promoteLongs : true } ) ;
970
+
971
+ expect ( doc ) . to . deep . equal ( { longOne : 1 , _id : 0 } ) ;
972
+ } ) ;
973
+ } ) ;
936
974
} ) ;
937
975
938
976
describe ( 'db' , ( ) => {
0 commit comments