Hello,
I have big issue with .find
.find(
{ _id: { $in: [
mongoose.Types.ObjectId('61dd423f973c056d38f8355f'),
mongoose.Types.ObjectId('61ddb79da7305b00090f8c38'),
mongoose.Types.ObjectId('61dd3a44973c056d38f8355e'),
] } },
)
But this code works (updateMany):
.updateMany(
{ _id: { $in: [
mongoose.Types.ObjectId('61dd423f973c056d38f8355f'),
mongoose.Types.ObjectId('61ddb79da7305b00090f8c38'),
mongoose.Types.ObjectId('61dd3a44973c056d38f8355e'),
] } },
[ {$set : {
"status": data.toState,
"generatedToOrder": data.ordered,
"date_modified": data.date_modified,
"clientIp": data.clientIp
}}
],
)
Error in .find
:
TypeError [ERR_INVALID_ARG_TYPE]: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer.
I don’t know why, but .find $in
not working as .updateMany $in