删除猫鼬分页中的重复项

如何通过此json中的“ user_id”属性删除重复的文档:

template<typename T>
struct IVector2 {
    T x,y;

    constexpr IVector2(T x,T y) : //constexpr constructor
        x(x),y(y) { }
};


static constexpr IVector2<int> floors(10,1);  // Initialized constexpr object. Now available at compile time

这是我的代码:

    {
    "searches": [
        {
            "_id": "5ed1fd3f22dfdd1c0b8129c7","word": "hello","user_id": "5ec95f3bbf0ae627713c0625","updatedAt": "2020-05-30T06:29:19.803Z","createdAt": "2020-05-30T06:29:19.803Z","__v": 0
        },{
            "_id": "5ed1fd3e22dfdd1c0b8129c6","word": "how","updatedAt": "2020-05-30T06:29:18.180Z","createdAt": "2020-05-30T06:29:18.180Z",{
            "_id": "5ed1fd3622dfdd1c0b8129c4","word": "house","updatedAt": "2020-05-30T06:29:10.062Z","createdAt": "2020-05-30T06:29:10.062Z",{
            "_id": "5ed1fd3c22dfdd1c0b8129c5","word": "hungry","user_id": "9yc95ftyyf0ae627713c5555","__v": 0
        }
    ],"total": 4,"limit": 5,"page": 1,"pages": 1
}

我要删除重复的文档。有人可以帮忙吗?

iCMS 回答:删除猫鼬分页中的重复项

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/2240166.html

大家都在问