lib/baseModel/lib/baseModel.js
function (args) {
                var shardKey = this.prototype.shardKey;
                var query = !_.isUndefined(args[0]) ? args[0] : {};
                var options = !_.isUndefined(args[1]) ? args[1] : {};
                var ignoreShardKey = MemberHelpers.getPathPropertyValue(options, 'ignoreShardKey') ? true : false;
                var missingFields = [];

                if (!_.isUndefined(shardKey) && !_.isUndefined(query) && !ignoreShardKey) {

                    for (let shardKeyField in shardKey) {
                        if (!query.hasOwnProperty(shardKeyField)) {
                            missingFields.push(shardKeyField);
                        }
                    }
                }

                return new Q.Promise(function (resolve, reject) {
                    if (!_.isEmpty(missingFields)) {
                        return reject("Query doesn't contain the shard key or parts of it. Missing fields: " + missingFields.join(', '));
                    }
                    return resolve();
                });
            }
function (args) {
                var shardKey = this.prototype.shardKey;
                var query = !_.isUndefined(args[0]) ? args[0] : {};
                var options = !_.isUndefined(args[1]) ? args[1] : {};
                var ignoreShardKey = MemberHelpers.getPathPropertyValue(options, 'ignoreShardKey') ? true : false;
                var missingFields = [];

                if (!_.isUndefined(shardKey) && !_.isUndefined(query) && !ignoreShardKey) {

                    for (let shardKeyField in shardKey) {
                        if (!query.hasOwnProperty(shardKeyField)) {
                            missingFields.push(shardKeyField);
                        }
                    }
                }

                return new Q.Promise(function (resolve, reject) {
                    if (!_.isEmpty(missingFields)) {
                        return reject("Query doesn't contain the shard key or parts of it. Missing fields: " + missingFields.join(', '));
                    }
                    return resolve();
                });
            }
function ( args ) { var shardKey = this . prototype . shardKey ; var query = ! _ . isUndefined ( args [ 0 ] ) ? args [ 0 ] : { } ; var options = ! _ . isUndefined ( args [ 1 ] ) ? args [ 1 ] : { } ; var ignoreShardKey = MemberHelpers . getPathPropertyValue ( options , 'ignoreShardKey' ) ? true : false ; var missingFields = [ ] ; if ( ! _ . isUndefined ( shardKey ) && ! _ . isUndefined ( query ) && ! ignoreShardKey ) { for ( let shardKeyField in shardKey ) { if ( ! query . hasOwnProperty ( shardKeyField ) ) { missingFields . push ( shardKeyField ) ; } } } return new Q . Promise ( function ( resolve , reject ) { if ( ! _ . isEmpty ( missingFields ) ) { return reject ( "Query doesn't contain the shard key or parts of it. Missing fields: " + missingFields . join ( ', ' ) ) ; } return resolve ( ) ; } ) ; }
Checks whether there is a shard key and if it is in the query
@param {Object} args
@returns {*}
@private
Checks whether there is a shard key and if it is in the query