@@ -1199,8 +1199,10 @@ export const OPTIONS = {
1199
1199
target : 'writeConcern' ,
1200
1200
transform ( { name, options, values : [ value ] } ) : WriteConcern {
1201
1201
const wc = WriteConcern . fromOptions ( {
1202
- ...options . writeConcern ,
1203
- fsync : getBoolean ( name , value )
1202
+ writeConcern : {
1203
+ ...options . writeConcern ,
1204
+ fsync : getBoolean ( name , value )
1205
+ }
1204
1206
} ) ;
1205
1207
if ( ! wc ) throw new TypeError ( `Unable to make a writeConcern from fsync=${ value } ` ) ;
1206
1208
return wc ;
@@ -1216,10 +1218,11 @@ export const OPTIONS = {
1216
1218
j : {
1217
1219
target : 'writeConcern' ,
1218
1220
transform ( { name, options, values : [ value ] } ) : WriteConcern {
1219
- console . warn ( 'j is deprecated' ) ;
1220
1221
const wc = WriteConcern . fromOptions ( {
1221
- ...options . writeConcern ,
1222
- journal : getBoolean ( name , value )
1222
+ writeConcern : {
1223
+ ...options . writeConcern ,
1224
+ journal : getBoolean ( name , value )
1225
+ }
1223
1226
} ) ;
1224
1227
if ( ! wc ) throw new TypeError ( `Unable to make a writeConcern from journal=${ value } ` ) ;
1225
1228
return wc ;
@@ -1229,8 +1232,10 @@ export const OPTIONS = {
1229
1232
target : 'writeConcern' ,
1230
1233
transform ( { name, options, values : [ value ] } ) : WriteConcern {
1231
1234
const wc = WriteConcern . fromOptions ( {
1232
- ...options . writeConcern ,
1233
- journal : getBoolean ( name , value )
1235
+ writeConcern : {
1236
+ ...options . writeConcern ,
1237
+ journal : getBoolean ( name , value )
1238
+ }
1234
1239
} ) ;
1235
1240
if ( ! wc ) throw new TypeError ( `Unable to make a writeConcern from journal=${ value } ` ) ;
1236
1241
return wc ;
@@ -1516,7 +1521,7 @@ export const OPTIONS = {
1516
1521
w : {
1517
1522
target : 'writeConcern' ,
1518
1523
transform ( { values : [ value ] , options } ) {
1519
- return WriteConcern . fromOptions ( { ...options . writeConcern , w : value as W } ) ;
1524
+ return WriteConcern . fromOptions ( { writeConcern : { ...options . writeConcern , w : value as W } } ) ;
1520
1525
}
1521
1526
} ,
1522
1527
waitQueueTimeoutMS : {
@@ -1528,8 +1533,10 @@ export const OPTIONS = {
1528
1533
transform ( { values : [ value ] , options } ) {
1529
1534
if ( isRecord ( value ) ) {
1530
1535
return WriteConcern . fromOptions ( {
1531
- ...options . writeConcern ,
1532
- ...value
1536
+ writeConcern : {
1537
+ ...options . writeConcern ,
1538
+ ...value
1539
+ }
1533
1540
} ) ;
1534
1541
}
1535
1542
throw new MongoParseError ( `WriteConcern must be an object, got ${ JSON . stringify ( value ) } ` ) ;
@@ -1539,8 +1546,10 @@ export const OPTIONS = {
1539
1546
target : 'writeConcern' ,
1540
1547
transform ( { values : [ value ] , options } ) {
1541
1548
const wc = WriteConcern . fromOptions ( {
1542
- ...options . writeConcern ,
1543
- wtimeout : getUint ( 'wtimeout' , value )
1549
+ writeConcern : {
1550
+ ...options . writeConcern ,
1551
+ wtimeout : getUint ( 'wtimeout' , value )
1552
+ }
1544
1553
} ) ;
1545
1554
if ( wc ) return wc ;
1546
1555
throw new MongoParseError ( `Cannot make WriteConcern from wtimeout` ) ;
@@ -1550,8 +1559,10 @@ export const OPTIONS = {
1550
1559
target : 'writeConcern' ,
1551
1560
transform ( { values : [ value ] , options } ) {
1552
1561
const wc = WriteConcern . fromOptions ( {
1553
- ...options . writeConcern ,
1554
- wtimeoutMS : getUint ( 'wtimeoutMS' , value )
1562
+ writeConcern : {
1563
+ ...options . writeConcern ,
1564
+ wtimeoutMS : getUint ( 'wtimeoutMS' , value )
1565
+ }
1555
1566
} ) ;
1556
1567
if ( wc ) return wc ;
1557
1568
throw new MongoParseError ( `Cannot make WriteConcern from wtimeout` ) ;
0 commit comments