Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-22781

Allow $lookup between ObjectId (_id.str) and string

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Duplicate
    • Affects Version/s: 3.2.1
    • Fix Version/s: None
    • Component/s: Aggregation Framework
    • Labels:

      Description

      this feature allows lookup using _id.str

      company: {_id: { $oid: "..."}, countryId: "566eb3c704c7b31facbb0007"}
      country: { _id: { $oid: "566eb3c704c7b31facbb0007", name:"..."} 
       
      { $lookup: {
             from: "country",
             localField: "countryId",    <= it's a string field
             foreignField: "_id.str",    <= using string representation of id
             as: "country"
      }}
      

        Attachments

          Issue Links

            Activity

              People

                Dates

                • Created:
                  Updated:
                  Resolved: