Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-6118

Importing a document with an empty object causes other objects on the same level to also be empty

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • 1.33.1
    • Affects Version/s: 1.33.0
    • Component/s: Import/Export
    • None
    • Not Needed

      Problem Statement/Rationale

      Importing a JSON file that looks like this (with empty objects: "fr": {}, "it": {}) via the Compass Add Data -> Import File UI

       

      [
      {
        "_id": {
          "$oid": "62e39685cc234a6c40cf3435"
        },
        "key": "productcreator.fields.renderjob.group",
        "namespace": "default",
        "__v": 0,
        "created": {
          "$numberLong": "1659082373113"
        },
        "lastUpdated": {
          "$numberLong": "1659082373113"
        },
        "locales": {
          "de": {
            "default": "Gruppe"
          },
          "en": {
            "default": "Group"
          },
          "fr": {},
          "it": {}
        }
      }
      ] 

       

       

      will import it like (Objects for "de": {"default": "Gruppe"},"en": {"default": "Group"}, are missing)

      Steps to Reproduce

      Import the localesnotworking.json via the Compass Add Data -> Import File UI

      localesnotworking.json

      Expected Results

      Import it like this:

       

      Actual Results

      is imported like this: (Objects for "de": {"default": "Gruppe"},"en": {"default": "Group"}, are missing)

      Additional Notes

      We are regularly exporting data from one Cluster to another, we use the export collection feature with a filter in the Compass UI, and are importing it again in the target cluster with the Add Data feature.

      This behavior does not occur when we import a document that does not include empty objects:

      [
      {
        "_id": {
          "$oid": "62e39685cc234a6c40cf3435"
        },
        "key": "productcreator.fields.renderjob.group",
        "namespace": "default",
        "__v": 0,
        "created": {
          "$numberLong": "1659082373113"
        },
        "lastUpdated": {
          "$numberLong": "1659082373113"
        },
        "locales": {
          "de": {
            "default": "Gruppe"
          },
          "en": {
            "default": "Group"
          },
          "fr": {
            "default": "Group"
          },
          "it": {
            "default": "Group"
          }
        }
      }
      ] 

        1. 2022-09-12 09_45_01-MongoDB Compass - 1 - DIVA-DEV_divaadmin.locales.png
          14 kB
          Daniel Rabanser
        2. 2022-09-12 09_48_18-MongoDB Compass - 1 - DIVA-DEV_divaadmin.locales.png
          19 kB
          Daniel Rabanser
        3. image-2022-09-12-10-12-13-363.png
          14 kB
          Daniel Rabanser
        4. image-2022-09-12-13-45-07-005.png
          17 kB
          Daniel Rabanser
        5. localesnotworking.json
          0.4 kB
          Daniel Rabanser

            Assignee:
            Unassigned Unassigned
            Reporter:
            daniel.rabanser@crystal-design.com Daniel Rabanser
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: