[COMPASS-6118] Importing a document with an empty object causes other objects on the same level to also be empty Created: 12/Sep/22  Updated: 13/Sep/22  Resolved: 13/Sep/22

Status: Closed
Project: Compass
Component/s: Import/Export
Affects Version/s: 1.33.0
Fix Version/s: 1.33.1

Type: Bug Priority: Major - P3
Reporter: Daniel Rabanser Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: PNG File 2022-09-12 09_45_01-MongoDB Compass - 1 - DIVA-DEV_divaadmin.locales.png     PNG File 2022-09-12 09_48_18-MongoDB Compass - 1 - DIVA-DEV_divaadmin.locales.png     PNG File image-2022-09-12-10-12-13-363.png     PNG File image-2022-09-12-13-45-07-005.png     File localesnotworking.json    
Documentation Changes: Not Needed

 Description   

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"
    }
  }
}
] 



 Comments   
Comment by Rhys Howell [ 13/Sep/22 ]

Hi daniel.rabanser@crystal-design.com - thanks for bringing this up. Sorry for any inconvenience the bug caused. This is fixed and will be in the future 1.33.1 release. There is a beta out now if you'd like to try it to replicate the behavior: https://github.com/mongodb-js/compass/releases
Thanks again!

Comment by Daniel Rabanser [ 12/Sep/22 ]

Unfortunately I can no longer edit the description of the ticket, the screenshot for the expected result is misleading, I uploaded the wrong one. 

It should be:

 

Generated at Wed Feb 07 22:41:59 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.