我想在MongoDB中获取从当前日期起最近6个月的用户数据。我是按状态过滤数据,而不是得到数组的响应。我还想根据日期应用另一个查询。我想根据最近6个月过滤一次,然后根据当前日期后的最近30天在另一个查询中过滤。
我的数据是-
{
_id: new ObjectId("63ac23187dc7d"),
details: 'hii there i am feeling great today',
status: '1',
createdAt: 2021-11-28T11:06:00.736Z
},
{
_id: new ObjectId("63ac23b357dc96"),
details: 'hi i am feeling good today',
status: '1',
createdAt: 2022-12-28T11:08:40.400Z,
},
{
_id: new ObjectId("63b2b2afa0d8e"),
details: 'Hello!! This is Ankit and feeling good',
status: '1',
createdAt: 2022-11-14T10:31:36.098Z
},
{
_id: new ObjectId("63b2b2sswa0d91"),
details: 'Felling bad a bit',
status: '1',
createdAt: 2023-01-02T10:32:27.149Z
},
{
_id: new ObjectId("63b2b2a0d94"),
details: 'Hmm, its ok ok',
status: '1',
createdAt: 2023-01-02T10:33:19.386Z
}