[英]Mongoose Cast to ObjectId failed for value “xxx” at path “_id”
I´m trying to get some files using a restriction where 我正在尝试使用限制获取一些文件,其中
ShipmentRequest.find()
.where('estatus').in(['Asignada','Inicio Carga','Fin Carga','En Transito','Entregada'])
.exec(function(err,solicitudes){
if(err){
return res.status(400).json({message:'Error, no se pudieron obtener las solicitudes',error:err});
}
else {
return res.status(200).json(solicitudes);
}
});
but I get this error 但是我得到这个错误
Cast to ObjectId failed for value "estatus" at path "_id"
I already used the same "where" restriction at the same collection with no errors so I don't understand why I'm getting it here. 我已经在同一集合中使用了相同的“ where”限制,没有错误,所以我不明白为什么要在这里使用它。
解决的办法是两条路线之间存在冲突,并且第一条路线要求一个_id
,第二条路线要求一个status
因此我更改了第二条路线以避免冲突,并且该路线有效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.