@@ -466,21 +466,27 @@ class CouchObjectProvider {
466
466
let stringifiedKeys = JSON . stringify ( keysToSearch ) ;
467
467
const url = `${ this . url } /_design/${ designDoc } /_view/${ viewName } ` ;
468
468
const requestBody = { } ;
469
+ let requestBodyString ;
470
+
469
471
if ( objectIdField === undefined ) {
470
472
requestBody . include_docs = true ;
471
473
}
472
474
475
+ if ( limit !== undefined ) {
476
+ requestBody . limit = limit ;
477
+ }
478
+
473
479
if ( startKey !== undefined && endKey !== undefined ) {
474
480
/* spell-checker: disable */
475
481
requestBody . startkey = startKey ;
476
482
requestBody . endkey = endKey ;
483
+ requestBodyString = JSON . stringify ( requestBody ) ;
484
+ requestBodyString = requestBodyString . replace ( '$START_KEY' , startKey ) ;
485
+ requestBodyString = requestBodyString . replace ( '$END_KEY' , endKey ) ;
477
486
/* spell-checker: enable */
478
487
} else {
479
488
requestBody . keys = stringifiedKeys ;
480
- }
481
-
482
- if ( limit !== undefined ) {
483
- requestBody . limit = limit ;
489
+ requestBodyString = JSON . stringify ( requestBody ) ;
484
490
}
485
491
486
492
let objectModels = [ ] ;
@@ -490,7 +496,7 @@ class CouchObjectProvider {
490
496
method : 'POST' ,
491
497
headers : { 'Content-Type' : 'application/json' } ,
492
498
signal : abortSignal ,
493
- body : JSON . stringify ( requestBody )
499
+ body : requestBodyString
494
500
} ) ;
495
501
496
502
if ( ! response . ok ) {
0 commit comments