await Response.find({
responder_id: req.user._id,
})
.populate({ path: "query_id", select: ["query_type", "content"] })
.find({ slider_value: 761 })
.find({ query_id: {} });
When the code above is runned, this is the error message returned to Postman:
{
"stringValue": "\"{}\"",
"valueType": "Object",
"kind": "ObjectId",
"value": {},
"path": "query_id",
"reason": {},
"name": "CastError",
"message": "Cast to ObjectId failed for value \"{}\" (type Object) at path \"query_id\" for model \"Response\""
}
So according to the message, the field query_id is still of type ObjectId and it doesn't behave like a regular javascript object, since it needs to be cast but can't anyways.
If my observation is correct, how can I get an ObjectId field to behave like a normal object after being populated?
It will solve this problem as well: