mongo1:27017:异常:聚合结果超出最大文档大小(16MB)

时间:2015-12-03 16:02:45

标签: php mongodb laravel

我尝试在我的laravel应用中运行mongo查询,但收到此帖子标题中列出的错误。我想我需要将useCursor设置为true,但无法让它发挥作用。这是我的代码:

    $email_duplicates = User::raw(function ($collection) {
        return $collection->aggregate(
            [
                [
                    '$group' => [
                        '_id' => [
                            'email' => '$email',
                        ],
                        'uniqueIds' => [
                            '$addToSet' => '$_id',
                        ],
                        'count' => [
                            '$sum' => 1,
                        ],
                    ],
                ],
                [
                    '$match' => [
                        'count' => [
                            '$gt' => 1,
                        ],
                    ],
                ],
            ],
            [
                'allowDiskUse' => true,
            ],
            [
                'useCursor' => true,
            ]
        );
    });

任何人都知道我做错了什么?

谢谢!

0 个答案:

没有答案