Command logs don't reflect actual command/reply documents

XMLWordPrintableJSON

    • None
    • Fully Compatible
    • Not Needed
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      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.

              Assignee:
              Jeffrey Yemin
              Reporter:
              Jeffrey Yemin
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: