두 개의 콜렉션 중 하나는 _id, title, options, result, feedback을 저장하는 질문이며 두 번째 아이는 store_id, score가 저장되어있는 아이입니다. 질문 모음에서 _id를 필터링했습니다. 어떻게 해야할지 모르겠다. 가능한 쿼리를 설정할 수 있습니까? 그래서 다음에 질문 모음에서 질문을 찾으면 필터링 된 질문을 보냅니다. 수단 두 번째 수집 자식 qustion_id와 다른 ID가 아닌 질문 컬렉션에서 해당 질문 만 반환합니다.노드 js를 사용하여 mongodb에 대한 쿼리 필터
이것은 내가 저장 질문, _id 제목 옵션 결과 피드백
_id:{type:String},
title:{type:String, required:true},
options:{type:Array, required:true},
result:{type:Array, required:true},
feedback:{type:String}
이 내가 가게 시도 question_id을 가지고이 아닌
quiz:[
{
questionId:{
type:mongoose.Schema.Types.ObjectId,
ref: 'Question',
index: true
},
score:{type:Number},
time:{type:String}
}
]
점수를 내 두 번째 모음이 처음 모음입니다 정확히 내가 예제를 만든다.
var query = {}
firstcollection.find($and[{_id:},{secondcollection question_id:}]},function(err, data){
so that filter data means filter _id will store in data.
and I send this data to the frontend
res.send(data);
});
답장을 보내 주셔서 감사합니다.하지만 쿼리를 통해 값을 가져올 수있는 모듈 또는 기술이 있습니다. –