2
다음의 mongoDB 쿼리를 Laravel Jessanger과 함께 사용하려고하는데,이를 raw
쿼리로 실행할 수 없습니다.mongoDB Jenssegers Laravel을 사용하여 Raw Query를 실행하십시오.
db.getCollection('users').aggregate([
{
"$group": {
"_id": { "cnic": "$cnic", "time_in": "$time_in" },
"uniqueIds": { "$addToSet": "$_id" },
"count": { "$sum": 1 }
}
},
{ "$match": { "count": { "$gt": 1 } } }
]).forEach(function(doc) {
doc.uniqueIds.shift();
db.getCollection('users').remove({_id : {$in: doc.uniqueIds }});
})
데이터베이스에서 중복 된 항목을 제거하는 것처럼이 일반 쿼리를 실행하고 싶습니다.
나는 다음과 같이 사용하려 :
문제가 있습니다. 해결 했습니까? –