@@ -247,7 +247,10 @@ describe('crud - insert', function () {
247
247
test . equal ( date . toString ( ) , doc . date . toString ( ) ) ;
248
248
test . equal ( date . getTime ( ) , doc . date . getTime ( ) ) ;
249
249
test . equal ( motherOfAllDocuments . oid . toHexString ( ) , doc . oid . toHexString ( ) ) ;
250
- test . equal ( motherOfAllDocuments . binary . value ( ) , doc . binary . value ( ) ) ;
250
+ test . equal (
251
+ motherOfAllDocuments . binary . value ( ) . toString ( 'hex' ) ,
252
+ doc . binary . value ( ) . toString ( 'hex' )
253
+ ) ;
251
254
252
255
test . equal ( motherOfAllDocuments . int , doc . int ) ;
253
256
test . equal ( motherOfAllDocuments . long , doc . long ) ;
@@ -398,7 +401,10 @@ describe('crud - insert', function () {
398
401
test . equal ( date . toString ( ) , doc . date . toString ( ) ) ;
399
402
test . equal ( date . getTime ( ) , doc . date . getTime ( ) ) ;
400
403
test . equal ( motherOfAllDocuments . oid . toHexString ( ) , doc . oid . toHexString ( ) ) ;
401
- test . equal ( motherOfAllDocuments . binary . value ( ) , doc . binary . value ( ) ) ;
404
+ test . equal (
405
+ motherOfAllDocuments . binary . value ( ) . toString ( 'hex' ) ,
406
+ doc . binary . value ( ) . toString ( 'hex' )
407
+ ) ;
402
408
403
409
test . equal ( motherOfAllDocuments . int , doc . int ) ;
404
410
test . equal ( motherOfAllDocuments . long , doc . long ) ;
@@ -1482,28 +1488,28 @@ describe('crud - insert', function () {
1482
1488
// in this case we are setting that node needs to be higher than 0.10.X to run
1483
1489
metadata : {
1484
1490
requires : {
1485
- topology : [ 'single' , 'replicaset' , 'ssl' , 'heap' , 'wiredtiger' ] ,
1486
1491
mongodb : '>=2.8.0'
1487
1492
}
1488
1493
} ,
1489
1494
1490
1495
test : function ( done ) {
1491
1496
var configuration = this . configuration ;
1492
1497
var client = configuration . newClient ( configuration . writeConcernMax ( ) , { maxPoolSize : 1 } ) ;
1498
+
1499
+ var document = {
1500
+ string : 'abcdefghijkl' ,
1501
+ objid : new ObjectId ( Buffer . alloc ( 12 , 1 ) ) ,
1502
+ double : new Double ( 1 ) ,
1503
+ binary : new Binary ( Buffer . from ( 'hello world' ) ) ,
1504
+ minkey : new MinKey ( ) ,
1505
+ maxkey : new MaxKey ( ) ,
1506
+ code : new Code ( 'function () {}' , { a : 55 } )
1507
+ } ;
1508
+
1493
1509
client . connect ( function ( err , client ) {
1494
1510
var db = client . db ( configuration . db ) ;
1495
1511
var collection = db . collection ( 'bson_types_insert_1' ) ;
1496
1512
1497
- var document = {
1498
- string : 'abcdefghijkl' ,
1499
- objid : new ObjectId ( 'abcdefghijkl' ) ,
1500
- double : new Double ( 1 ) ,
1501
- binary : new Binary ( Buffer . from ( 'hello world' ) ) ,
1502
- minkey : new MinKey ( ) ,
1503
- maxkey : new MaxKey ( ) ,
1504
- code : new Code ( 'function () {}' , { a : 55 } )
1505
- } ;
1506
-
1507
1513
collection . insert ( document , configuration . writeConcernMax ( ) , function ( err , result ) {
1508
1514
expect ( err ) . to . not . exist ;
1509
1515
test . ok ( result ) ;
@@ -1512,9 +1518,9 @@ describe('crud - insert', function () {
1512
1518
expect ( err ) . to . not . exist ;
1513
1519
test . equal ( 'abcdefghijkl' , doc . string . toString ( ) ) ;
1514
1520
1515
- collection . findOne ( { objid : new ObjectId ( 'abcdefghijkl' ) } , function ( err , doc ) {
1521
+ collection . findOne ( { objid : new ObjectId ( Buffer . alloc ( 12 , 1 ) ) } , function ( err , doc ) {
1516
1522
expect ( err ) . to . not . exist ;
1517
- test . equal ( '6162636465666768696a6b6c' , doc . objid . toString ( ) ) ;
1523
+ test . equal ( '01' . repeat ( 12 ) , doc . objid . toString ( ) ) ;
1518
1524
1519
1525
collection . findOne ( { double : new Double ( 1 ) } , function ( err , doc ) {
1520
1526
expect ( err ) . to . not . exist ;
0 commit comments