在mongodb。我在用户数组的 id 中有一个对象,现在我想在相关用户详细信息中查找该 id,并进行聚合

In mongodb. I have One object inside ids of user array , Now I want to lookup for that ids in related users details, with aggregation

  {
        "_id": "61efc2c437c455b7216629ff",
        "event_images": [
            "1643102858880rn_image_picker_lib_temp_38cdc02f-4207-446a-9263-1e6914954095.jpg"
        ],
        "distance": 80,
        "ratio_men": 50,
        "ratio_women": 60,
        "ratio_others": 30,
        "invite_users": [
            "61e6830ae88d1929e3d239f9",
            "61e6830ae88d1929e3d239f9",
            "615ae0e5da07c2f5d777248b",
            "615ae0e5da07c2f5d777248b",
            "61e7beaae88d1929e3627c69",
            "61e7beaae88d1929e3627c69"
        ],
        "notinvited_users": [],

我在我有 ID 的数组中有 Invited 用户数组,我想用这些 ID 查找用户详细信息

自己动手 你能行的 你对此非常了解

或者你可以试试这个

const userData = await Event.find({ _id : 对象 ID(ID) , payment_status:1 }).populate('invite_users' , {名字:1})