【发布时间】:2023-01-14 18:26:54
【问题描述】:
我想在查询响应中添加结果数,并将结果放在一个数组中。 你能帮我么?
这是我当前的 MongoDB 查询:https://sourceb.in/kUL9kKDq2c。
以下是预期结果的示例(包含 500 个结果的示例):
{
response: [{
_id: new ObjectId("627d7828990fff996621d5ea"),
Name: 'test date',
ActorId: 3,
MovieId: 1,
State: 100,
ActorWatched: [110],
RatedCount: 2,
PublishedDate: 2022 - 05 - 12 T21: 21: 41.081 Z,
AverageRating: 5,
StarCoinsEarned: 100
},
{
_id: new ObjectId("627d7828990fff996621d5ea"),
Name: 'test date',
ActorId: 3,
MovieId: 2,
State: 100,
ActorWatched: [],
RatedCount: 1,
PublishedDate: 2022 - 05 - 12 T21: 21: 41.081 Z,
AverageRating: 5,
StarCoinsEarned: 100
}],
count: 500
}
预先感谢您的帮助!
【问题讨论】: