@@ -73,7 +73,9 @@ function setScopeValuesFromWhere(data, where, targetModel) {
73
73
* @param {String|Array|Object } source The runtime value of `include` option
74
74
* @returns {Object }
75
75
*/
76
- function mergeIncludes ( destination , source ) {
76
+ // function mergeIncludes(destination, source) {
77
+ // NOTE see: https://github.com/strongloop/loopback-datasource-juggler/pull/787
78
+ function mergeIncludes ( source , destination ) {
77
79
var destArray = convertToArray ( destination ) ;
78
80
var sourceArray = convertToArray ( source ) ;
79
81
if ( destArray . length === 0 ) {
@@ -193,12 +195,20 @@ function mergeQuery(base, update, spec) {
193
195
}
194
196
195
197
// Overwrite fields
196
- if ( spec . fields !== false && update . fields !== undefined ) {
198
+ // NOTE see: https://github.com/strongloop/loopback-datasource-juggler/pull/787
199
+ if ( spec . fields !== false && base . fields === undefined && update . fields !== undefined ) {
197
200
base . fields = update . fields ;
198
- } else if ( update . fields !== undefined ) {
201
+ } else if ( spec . fields !== false && update . fields !== undefined ) {
199
202
base . fields = [ ] . concat ( base . fields ) . concat ( update . fields ) ;
200
203
}
201
204
205
+ // // Overwrite fields
206
+ // if (spec.fields !== false && update.fields !== undefined) {
207
+ // base.fields = update.fields;
208
+ // } else if (update.fields !== undefined) {
209
+ // base.fields = [].concat(base.fields).concat(update.fields);
210
+ // }
211
+
202
212
// set order
203
213
if ( ( ! base . order || spec . order === false ) && update . order ) {
204
214
base . order = update . order ;
0 commit comments