[SERVER-3129] Include projection in the slow query logs Created: 22/May/11  Updated: 21/Oct/15  Resolved: 21/Oct/15

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

Type: Improvement Priority: Major - P3
Reporter: Srirang G Doddihal Assignee: David Storch
Resolution: Duplicate Votes: 4
Labels: logging
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Observed on Linux, very likely affects ALL


Issue Links:
Duplicate
Related
is related to SERVER-17862 Unify stats reporting for log/profile... Closed
Participants:

 Description   

Whenever a query is made to fetch a subset of fields it would be good to have mongod log the request subset of fields along with the query itself. Currently when running in verbose mode the query document is fully logged where as the requested fields are not.



 Comments   
Comment by David Storch [ 21/Oct/15 ]

Queries with a projection issued using the find command will display the projection in the slow query log:

2015-10-21T12:13:12.756-0400 I COMMAND  [conn1] command test.foo command: find { find: "foo", filter: { a: 1.0 }, projection: { _id: 0.0, b: 1.0 } } planSummary: COLLSCAN keysExamined:0 docsExamined:2 cursorExhausted:1 keyUpdates:0 writeConflicts:0 numYields:0 nreturned:1 reslen:118 locks:{ Global: { acquireCount: { r: 2 } }, Database: { acquireCount: { r: 1 } }, Collection: { acquireCount: { r: 1 } } } protocol:op_command 0ms

Note that the log lists all find command parameters, including one called projection. This logging is only present with a version 3.2 server where the query is issued using an updated-for-3.2 driver. The work was done as part of SERVER-15176, so I am resolving as a duplicate.

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