MCPcopy
hub / github.com/sequelize/sequelize / where

Method where

src/model.js:3581–3595  ·  view source on GitHub ↗

* Get an object representing the query for this instance, use with `options.where` * * @param {boolean} [checkVersion=false] include version attribute in where hash * * @returns {object}

(checkVersion)

Source from the content-addressed store, hash-verified

3579 * @returns {object}
3580 */
3581 where(checkVersion) {
3582 const where = this.constructor.primaryKeyAttributes.reduce((result, attribute) => {
3583 result[attribute] = this.get(attribute, { raw: true });
3584 return result;
3585 }, {});
3586
3587 if (_.size(where) === 0) {
3588 return this.constructor.options.whereCollection;
3589 }
3590 const versionAttr = this.constructor._versionAttribute;
3591 if (checkVersion && versionAttr) {
3592 where[versionAttr] = this.get(versionAttr, { raw: true });
3593 }
3594 return Utils.mapWhereFieldNames(where, this.constructor);
3595 }
3596
3597 toString() {
3598 return `[object SequelizeInstance:${this.constructor.name}]`;

Callers 15

saveMethod · 0.95
reloadMethod · 0.95
destroyMethod · 0.95
incrementMethod · 0.95
dao.test.jsFile · 0.45
scope.test.jsFile · 0.45
where.tsFile · 0.45
sequelize.tsFile · 0.45

Calls 1

getMethod · 0.95

Tested by

no test coverage detected