[SERVER-21610] Field names should be quoted in logs Created: 21/Nov/15  Updated: 29/Feb/20  Resolved: 28/Feb/20

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

Type: Bug Priority: Major - P3
Reporter: Joanna Cheng Assignee: Henrik Edin
Resolution: Done Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
related to SERVER-18240 Support copy and paste of queries fro... Backlog
Operating System: ALL
Sprint: Dev Tools 2020-01-13, Dev Tools 2020-01-27, Dev Tools 2020-02-10
Participants:

 Description   

Lack of quoting means it can be impossible to tell what the query actually is.

Real example:

2015-11-20T16:46:35.074-0500 I COMMAND  [conn1166] command foo.bar command: find { find: "bar", filter: {  _id: "foobar" }, shardVersion: [ Timestamp 2000|7, ObjectId('564fd7ca4529a9f9b23074ed') ] } planSummary: COLLSCAN keysExamined:0 docsExamined:344866188 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:2694991 nreturned:0 reslen:216 locks:{ Global: { acquireCount: { r: 5389984 } }, Database: { acquireCount: { r: 2694992 } }, Collection: { acquireCount: { r: 2694992 } } } protocol:op_command 1173549ms

Why is this query using a COLLSCAN instead of IDHACK? Because the query is actually on the field " _id".

Contrived example:
What's the difference between these queries?

2015-11-21T22:24:19.430+1100 I COMMAND  [conn29] command test.foo command: find { find: "foo", filter: { abc: 1.0, def: 1.0, a: 1.0 }, shardVersion: [ Timestamp 2000|7, ObjectId('564fd7ca4529a9f9b23074ed') ] } planSummary: IXSCAN { a: "hashed" } keysExamined:4 docsExamined:4 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:0 reslen:211 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_command 0ms
2015-11-21T22:26:40.657+1100 I COMMAND  [conn30] command test.foo command: find { find: "foo", filter: { abc: 1.0, def: 1.0, a: 1.0 }, shardVersion: [ Timestamp 2000|7, ObjectId('564fd7ca4529a9f9b23074ed') ] } planSummary: IXSCAN { a: "hashed" } keysExamined:4 docsExamined:4 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:0 reslen:211 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_command 0ms

They look identical, but were generated by the (very different) queries:

db.foo.find({abc: 1, def : 1, a:1})
db.foo.find({'abc: 1.0, def' : 1, a:1})


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