[SERVER-13245] system.profile query format inconsistent Created: 18/Mar/14  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Diagnostics, Querying, Usability
Affects Version/s: 2.2.7, 2.4.9, 2.6.0-rc1
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Thomas Rueckstiess Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-6768 MongoDB Profiler creates illegal docu... Closed
Assigned Teams:
Query Execution
Participants:

 Description   

There are several schemas for how queries with/without sort are stored in system.profile. This makes it unnecessarily complex to run aggregation over system.profile collections that access the query patterns.

There should be a single common format for all queries.

simple find, no sort : query on top level

db.docs.find({a: 1})
 
	"query" : {
		"a" : 1
	},

find with sort, query is nested in another query field, without $.

db.docs.find({a: 1}).sort({b:1})
 
	"query" : {
		"query" : {
			"a" : 1
		},
		"orderby" : {
			"b" : 1
		}
	},

$query / $orderby syntax, results in nested $query field with $.

db.docs.find({ $query: {a: 1}, $orderby: {b: 1} })
 
	"query" : {
		"$query" : {
			"a" : 1
		},
		"$orderby" : {
			"b" : 1
		}
	},


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