Robomongo: Edit document can create duplicate fields

Created on 18 Dec 2014  路  1Comment  路  Source: Studio3T/robomongo

In mongo (and robomongo) shell:

db.tasks.insert({"a":1,"a":2})

will produce a document:

{
    "a": 2
}

However if you click edit document in robomongo and change the document to:

{
    "a": 1,
    "a": 2
}

Now when doing a find() robomongo will return the above document but mongo shell will return

{
    "a": 1,
    "a": 1
}

I guess robomongo should either fail when attempting to add duplicate fields or at least be consistent with mongo shell?

bug

Most helpful comment

This issue caused a bit of a headache. A duplicate field was added by mistake to a document, and suddenly the response back from MongoDB is different than what you are seeing in Robo 3T.

MongoDB documentation states this:

"BSON documents may have more than one field with the same name. Most MongoDB interfaces, however, represent MongoDB with a structure (e.g. a hash table) that does not support duplicate field names. "

This should definitely throw some validation error in Robo 3T when trying to add duplicate field

>All comments

This issue caused a bit of a headache. A duplicate field was added by mistake to a document, and suddenly the response back from MongoDB is different than what you are seeing in Robo 3T.

MongoDB documentation states this:

"BSON documents may have more than one field with the same name. Most MongoDB interfaces, however, represent MongoDB with a structure (e.g. a hash table) that does not support duplicate field names. "

This should definitely throw some validation error in Robo 3T when trying to add duplicate field

Was this page helpful?
0 / 5 - 0 ratings