Hi guys, I wonder why this is not working…
This function should return true if there are any documents that match query.
Thing I want to do is if the frequency is one time, just want to set query with creatorDetails.uuid and measureId to find()
hasCompleted(userId) {
// ....
const query = {
'creatorDetails.uuid': userId,
measureId: this._id,
};
if (this.typeOptions.frequency === Frequency.ONE_TIME) {
return query;
}
// ....
console.log(query);
return MeasureData.find(query).count() > 0;
}
query console.log
{
creatorDetails.uuid: "wD7BaeY6SsNSBgjbg"
measureId: "GFKdwrmwkZ6FkAsco"
}
Now I’m looking on studio 3t and there is a document matching this
db.getCollection("MeasureData").find({
"creatorDetails.uuid" : "wD7BaeY6SsNSBgjbg",
"measureId": "GFKdwrmwkZ6FkAsco",
})
but this hasCompleted()
still returns false…