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

Method where

lib/model.js:3455–3469  ·  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

3453 * @returns {object}
3454 */
3455 where(checkVersion) {
3456 const where = this.constructor.primaryKeyAttributes.reduce((result, attribute) => {
3457 result[attribute] = this.get(attribute, { raw: true });
3458 return result;
3459 }, {});
3460
3461 if (_.size(where) === 0) {
3462 return this.constructor.options.whereCollection;
3463 }
3464 const versionAttr = this.constructor._versionAttribute;
3465 if (checkVersion && versionAttr) {
3466 where[versionAttr] = this.get(versionAttr, { raw: true });
3467 }
3468 return Utils.mapWhereFieldNames(where, this.constructor);
3469 }
3470
3471 toString() {
3472 return `[object SequelizeInstance:${this.constructor.name}]`;

Callers 15

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

Calls 1

getMethod · 0.95

Tested by

no test coverage detected