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

Feature Request: Merge

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Minor - P4
    • Resolution: Duplicate
    • None
    • None
    • Querying
    • None
    • Fully Compatible

    Description

      If this feature request already exists I couldn't find it, so just point me to that so I can follow it

      I had to switch from mongodb to mysql at work this week because I couldn't find a way to merge collections. If this exists, I sure couldn't find it.

      Basically, the request is to be able to merge one collection into another. With logic for matching documents that looks like $lookup, and different updates for on match, on missing on source, and on missing on target. I imagine the syntax looking something like this

      db.inventory.merge({from: "inventory_temp",
                localField: "sku",
                foreignField: "sku",
                as: "inventory_docs"},
       {status: "inventory_docs.status"},
      {$unset: true},
      {name: "inventory_docs.name", status: "inventory_docs.status"});
      

      The first paramenter being the $lookup criteria that must result in a 1:1 match or no match. The second being the update if matched. The third being the update if the document is missing on the source, in this case delete it on the target. And lastly the not matched on the target specifies an insert.

      I'm keeping this short in case this request already exists, if it doesn't I can certainly flush it out

      Attachments

        Issue Links

          Activity

            People

              asya.kamsky@mongodb.com Asya Kamsky
              jlaustill@gmail.com Joshua Austill
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: