mongodb에서 일하고 있습니다. 나는 쿼리mongo에서 쿼리 작업이 있지만 호출 방법이 아닙니다.
db.ekgs.find({_id: ObjectId("54cd1dd3adc274b20a7f650d"),"interpretationList.interpretations" : { $all:[[ObjectId("54c09fb3581c4c8c218d1a39"),ObjectId("54c09fb3581c4c8c218d1a3a")]]}})
가 몽고에 cmd에서 일을 작성합니다. 하지만 사용자로부터 입력을받는 방법으로이 코드를 작성하면 작동하지 않습니다.
{
"ekgId":"54cdaed7adc274b20a7f650e",
"diagnosis":
[
"54c09fb3581c4c8c218d1a39",
"54c09fb3581c4c8c218d1a3a"
]
};
을 내 방식으로 내가 항상 null를 돌려
modalSchema.find({"_id": req.body.ekgId,'interpretationList.interpretations' :{ $all :req.body.diagnosis , $size: arrLength }});
쓰기 :
req.body이 포함되어 있습니다.
스키마 컬렉션 :
{
"_id" : ObjectId("54cdaed7adc274b20a7f650e"),
"title" : "Demo Ekg",
"description" : "Demo Description",
"diagnosis" : "Demo Diagnosis",
"ekgImageExtension" : "jpg",
"urgency" : "Demo Urgency",
"therapy" : "Demo Therapy",
"differentialDiagnosis" : "Demo Ddx",
"history" : "Demo History",
"references" : "Demo References",
"fileName" : "",
"imageURL" : "images/Ekgs/54c09d68581c4c8c218d1a38/54c09d68581c4c8c218d1a38.jpg",
"interpretationList" : {
"interpretations" : [
ObjectId("54c09fb3581c4c8c218d1a39"),
ObjectId("54c09fb3581c4c8c218d1a3a")
]
},
"tags" : [
{
"_id" : ObjectId("54c255da581c4c8c218d2397"),
"tagName" : "Tag 1"
}
],
"segment" : [
{
"explanation" : "Demo Explanation 1",
"fileName" : "",
"imageURL" : "",
"level" : {
"_id" : ObjectId("54c25616581c4c8c218d2398"),
"levelName" : "Level 1"
}
},
{
"explanation" : "Demo Explanation 2",
"fileName" : "",
"imageURL" : "",
"level" : {
"_id" : ObjectId("54c25616581c4c8c218d2398"),
"levelName" : "Level 1"
}
}
]
}
질문을 컬렉션의'스키마 '로 업데이트 할 수 있습니까? – BatScream
'interpretations'는'ObjectIds'의 배열이지만'Strings' 배열을 전달하고 있습니까? – BatScream