나는 약간의 도움이 필요하지만 나는 가깝다고 느낀다. 그것은 리튬을 포함하고 MongoDB를 코드는 다음과 같습니다 : catch되지 않은 예외 : http://pastium.org/view/0403d3e4f560e3f790b32053c71d0f2b지도 줄이기 가장 인기있는 태그
$db = PopularTags::connection();
$map = new \MongoCode("function() {
if (!this.saved_terms) {
return;
}
for (index in this.saved_terms) {
emit(this.saved_terms[index], 1);
}
}");
$reduce = new \MongoCode("function(previous, current) {
var count = 0;
for (index in current) {
count += current[index];
}
return count;
}");
$metrics = $db->connection->command(array(
'mapreduce' => 'users',
'map' => $map,
'reduce' => $reduce,
'out' => 'terms'
));
$cursor = $db->connection->selectCollection($metrics['result'])->find()->limit(1);
print_r($cursor);
/**
User Data In Mongo
{
"_id" : ObjectId("4e789f954c734cc95b000012"),
"email" : "[email protected]",
"saved_terms" : [
null,
[
"technology",
" apple",
" iphone"
],
[
"apple",
" water",
" beryy"
]
] }
**/
나는 그들이에 검색 한 후 내가 가장 대부분의 플레이 약관 를 얻기 위해 노력하고 있지만이 같은 오류가 계속 사용자 저축 용어를 데 'MongoDB :: __ construct (invalid name') 메시지가있는 '예외'누군가에게이 방법이나 방향을 알려줄 수있는 방법이 있습니까?