如何通过此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",
"user_id": "5ec95f3bbf0ae627713c0625",
"updatedAt": "2020-05-30T06:29:18.180Z",
"createdAt": "2020-05-30T06:29:18.180Z",
"__v": 0
},
{
"_id": "5ed1fd3622dfdd1c0b8129c4",
"word": "house",
"user_id": "5ec95f3bbf0ae627713c0625",
"updatedAt": "2020-05-30T06:29:10.062Z",
"createdAt": "2020-05-30T06:29:10.062Z",
"__v": 0
},
{
"_id": "5ed1fd3c22dfdd1c0b8129c5",
"word": "hungry",
"user_id": "9yc95ftyyf0ae627713c5555",
"updatedAt": "2020-05-30T06:29:10.062Z",
"createdAt": "2020-05-30T06:29:10.062Z",
"__v": 0
}
],
"total": 4,
"limit": 5,
"page": 1,
"pages": 1
}
我要删除重复的文档。有人可以帮忙吗?