[SERVER-30393] MongoDB is accepting duplicate elements within the same level Created: 28/Jul/17  Updated: 31/Jul/17  Resolved: 28/Jul/17

Status: Closed
Project: Core Server
Component/s: Write Ops
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Critical - P2
Reporter: Basel Yousef Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-6439 Duplicate fields at the same level sh... Backlog
Operating System: ALL
Steps To Reproduce:

Create a list in R and try to append it to itself then insert the record into Mongo

Participants:

 Description   

MongoDB is found to accept duplicate elements within the same level inside a document.
The issue is faced when inserting record into MongoDB from R 3.3.2 using rmongodb library.

The severity of this issue is that Mongodb didn't complain about it at all.
When trying to view the document inside Mongochef Studio 3T, you can't actually see the duplicate, instead you only see one element.

However, when trying to query it using C# driver and looping through the code generates an error complaining about a duplicate element.

When trying to view the document using Mongo Shell you can't see the duplicate either and you just see one element.

So basically you have duplicate inside your documents but you can't see it and you are not aware of it until you interrogate it using C# driver.

I hope this explains it, and I'm happy to answer any questions.



 Comments   
Comment by Kelsey Schubert [ 31/Jul/17 ]

Hi yousefbasel,

Since this is an ongoing open issue, the specific version that is does not indicate that this issue is unique. MongoDB currently relies on the client/driver to provide documents that do not contain duplicate fields at the same level. JSON standards do not specify the correct behavior when there are duplicate fields, and consequently recommend that users ensure field names are unique. For more details, see https://tools.ietf.org/html/rfc7159#section-4 and http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf

As a result of this ambiguity, different drivers may behave behave differently and allow the insertion of duplicate field names at the same level. SERVER-6439 moves the responsibility to the MongoDB Server from the client/drivers to ensure that the documents contain only unique field names.

Hope this helps to clarify,
Thomas

Comment by Basel Yousef [ 31/Jul/17 ]

Thanks for your reply [Roman Fernandez]
This is not a duplicate since it is a different issue from the ticket you mentioned, this issue is reported on a server running 3.2.9 version of Mongodb.
This is why I mentioned that it only happens when being inserted from R.

I hope this makes sense, please let me know if you need more information.

Thanks,
Basel

Comment by Ramon Fernandez Marina [ 28/Jul/17 ]

Thanks for your report yousefbasel; there's an existing ticket (SERVER-6439) to address this behavior, so I'm going to close this ticket as a duplicate. Feel free to vote for SERVER-6439 and watch it for updates.

Thanks,
Ramón.

Generated at Thu Feb 08 04:23:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.