Details
-
Bug
-
Resolution: Fixed
-
Minor - P4
-
None
-
None
-
Fully Compatible
-
Not Needed
-
Description
This code:
var client = MongoClients.create();
|
var coll = client.getDatabase("test").getCollection("dup", JsonObject.class);
|
coll.drop();
|
coll.insertOne(new JsonObject("{x: 1, x: 2}"));
|
System.out.prinlin(coll.find().first().getJson());
|
outputs
{"_id": {"$oid": "..."}, "x": 1, "x": 2}
|
but logs:
Command "insert" started on database test using a connection with driver-generated ID 3 and server-generated ID 7946 to localhost:27017. The request ID is 6. Command: {"insert": "dup", "ordered": true, "$db": "test", "documents": [{"x": 2}]}
|
|
|
...
|
Command "find" succeeded in 1.64 ms using a connection with driver-generated ID 3 and server-generated ID 7946 to localhost:27017. The request ID is 7. Command reply: {"cursor": {"firstBatch": [{"_id": {"$oid": "..."}, "x": 2}], "id": 0, "ns": "test.dup"}, "ok": 1.0}
|
{
|
Notice that the duplicate `x` field that was actually sent to and received from the server does not appear in the logs.