Changeset View
Changeset View
Standalone View
Standalone View
lib/app/base-chips/special_filters/IsReferencedByResourcesMatching.js
Show All 17 Lines | class IsReferencedByResourcesMatching extends app.SpecialFilter { | ||||
assert(params); | assert(params); | ||||
assert(collection); | assert(collection); | ||||
assert(collection instanceof Collection); | assert(collection instanceof Collection); | ||||
assert(collection.fields[referencing_field]); | assert(collection.fields[referencing_field]); | ||||
assert(collection.fields[field_to_check]); | assert(collection.fields[field_to_check]); | ||||
assert(Array.isArray(allowed_values)); | assert(Array.isArray(allowed_values)); | ||||
assert(typeof nopass_reason === "string"); | assert(typeof nopass_reason === "string"); | ||||
} | } | ||||
async getFilteringQuery() { | async getFilteringQuery() { | ||||
const query = new Query(); | const query = new Query(); | ||||
const lookup_id = query.lookup({ | const lookup_id = query.lookup({ | ||||
from: this.params.collection.name, | from: this.params.collection.name, | ||||
localField: "sealious_id", | localField: "sealious_id", | ||||
foreignField: this.params.referencing_field, | foreignField: this.params.referencing_field, | ||||
}); | }); | ||||
query.match({ | query.match({ | ||||
Show All 14 Lines |