This repository was archived by the owner on May 31, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -552,11 +552,15 @@ const prepareRequest = (model) => {
552552 }
553553 } else if ( item === 'readPreferenceTags' ) {
554554 if ( model . readPreferenceTags ) {
555- req . query . readPreferenceTags = Object . keys (
555+ req . query . readPreferenceTags = Object . values (
556556 model . readPreferenceTags
557- )
558- . map ( tag => `${ tag } :${ model . readPreferenceTags [ tag ] } ` )
559- . join ( ',' ) ;
557+ ) . map (
558+ tagGroup => Object . keys (
559+ tagGroup
560+ )
561+ . map ( tag => `${ tag } :${ tagGroup [ tag ] } ` )
562+ . join ( ',' )
563+ ) ;
560564 }
561565 } else if ( model [ item ] !== '' ) {
562566 req . query [ item ] = model [ item ] ;
Original file line number Diff line number Diff line change @@ -72,7 +72,14 @@ const tests = [
7272 'with readPreference, maxStalenessSeconds and readPreferenceTags' ,
7373 connectionString :
7474 'mongodb://mongos1.example.com:27017,mongos2.example.com:27017/?' +
75- 'readPreference=secondary&maxStalenessSeconds=120&readPreferenceTags=0%3A%5Bobject%20Object%5D&ssl=false'
75+ 'readPreference=secondary&maxStalenessSeconds=120&readPreferenceTags=dc%3Any%2Crack%3A1&ssl=false'
76+ } ,
77+ {
78+ description :
79+ 'with multiple readPreferenceTags' ,
80+ connectionString :
81+ 'mongodb://mongos1.example.com:27017,mongos2.example.com:27017/?' +
82+ 'readPreference=primary&readPreferenceTags=dc%3Any%2Crack%3A1&readPreferenceTags=region%3Anorth%2Cdatacenter%3AA&ssl=false'
7683 } ,
7784 {
7885 description : 'with authSource and authMechanism' ,
You can’t perform that action at this time.
0 commit comments