[DOCS-15074] [TOOLS] mongoimport / mongod accepts JSON documents with duplicate keys Created: 31/Jan/22  Updated: 30/Oct/23  Resolved: 31/Jan/22

Status: Closed
Project: Documentation
Component/s: tools
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Task
Reporter: Anonymous Assignee: Unassigned
Resolution: Won't Fix Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Documented
documents TOOLS-55 mongoimport / mongod accepts JSON doc... Closed
Participants:
Days since reply: 2 years, 1 week, 2 days ago

 Description   

Engineering Description
It is possible to import the following document into mongo using mongimport

{ "_id" : { "$oid" : "4e2f0a99a26037e417000056" }, "info" : { "Qu" : { "start" : "a", "stop" : 1320779121 }, "Se" : { "start" : 1320021628, "stop" : 1320779121 }, "Se I" : { "start" : "a", "stop" : 1320779121 }, "Se I_Se M" : { "start" : "a", "stop" : 1320779121 }, "Se M" : { "start" : "a", "stop" : 1320779121 }, "Se" : { "start" : "a" }, "So" : { "start" : "a", "stop" : 1320779121 } } }

In this case info.Se is duplicated. No error is generated. Reading this document from the mongoshell or through the PHP driver gives different outputs (since different languages handle this differently).

Shouldn't it be up to the mongo server to ensure that every key in every document is unique and generate warnings/exceptions when this is not the case ? I can't see any reason why the server should handle duplicate keys ...



 Comments   
Comment by Jeffrey Allen [ 31/Jan/22 ]

Looks like no work was done for the linked TOOLS ticket. It was closed as "Works as Designed". Therefore I don't think any docs updates are required.

Generated at Thu Feb 08 08:11:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.