@@ -466,21 +466,27 @@ class CouchObjectProvider {
466466 let stringifiedKeys = JSON . stringify ( keysToSearch ) ;
467467 const url = `${ this . url } /_design/${ designDoc } /_view/${ viewName } ` ;
468468 const requestBody = { } ;
469+ let requestBodyString ;
470+
469471 if ( objectIdField === undefined ) {
470472 requestBody . include_docs = true ;
471473 }
472474
475+ if ( limit !== undefined ) {
476+ requestBody . limit = limit ;
477+ }
478+
473479 if ( startKey !== undefined && endKey !== undefined ) {
474480 /* spell-checker: disable */
475481 requestBody . startkey = startKey ;
476482 requestBody . endkey = endKey ;
483+ requestBodyString = JSON . stringify ( requestBody ) ;
484+ requestBodyString = requestBodyString . replace ( '$START_KEY' , startKey ) ;
485+ requestBodyString = requestBodyString . replace ( '$END_KEY' , endKey ) ;
477486 /* spell-checker: enable */
478487 } else {
479488 requestBody . keys = stringifiedKeys ;
480- }
481-
482- if ( limit !== undefined ) {
483- requestBody . limit = limit ;
489+ requestBodyString = JSON . stringify ( requestBody ) ;
484490 }
485491
486492 let objectModels = [ ] ;
@@ -490,7 +496,7 @@ class CouchObjectProvider {
490496 method : 'POST' ,
491497 headers : { 'Content-Type' : 'application/json' } ,
492498 signal : abortSignal ,
493- body : JSON . stringify ( requestBody )
499+ body : requestBodyString
494500 } ) ;
495501
496502 if ( ! response . ok ) {
0 commit comments