[SERVER-6767] Interpret $query as special so you can copy profiler/logged queries into shell Created: 14/Aug/12 Updated: 20/Jun/16 Resolved: 19/Oct/15 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell, Usability |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Minor - P4 |
| Reporter: | Scott Hernandez (Inactive) | Assignee: | David Storch |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Participants: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Description |
|
If the query starts with [$]query (like db.coll.find({$query:{...}})) then we should set the _special boolean to true. This will allow running this:
|
| Comments |
| Comment by David Storch [ 19/Oct/15 ] | |
|
Hi drsmith, I believe the shell command you are looking for in order to explain a query with a min and with a limit is as follows:
Granted, the docs about how to use explain are a bit scattered and hard to track down, so I've filed an improvement request with our documentation team: DOCS-6403. Note that starting in version 3.2, use of $-prefixed options inside the query predicate ($min, $max, $maxScan, $returnKey, etc.) will be deprecated. Instead, shell code should use the corresponding shell helpers (.min(), .max(), .maxScan(), .returnKey() etc.). This will be documented by Since the $query format is now illegal in the shell, I am closing this ticket as "Won't Fix". Best, | |
| Comment by Devin Smith [ 19/Oct/15 ] | |
|
Almost 3 years! Would be great to get this fixed. I've got a query I don't think I can use the workaround (suggested here https://jira.mongodb.org/browse/SERVER-14564) for. db.collection.find({$min:{...}}, {$query:{}}).limit(X).explain() is not the same as db.collection.find({$min:{...}}, {$query:{}}, $explain: true).limit(X). Is there a workaround to limit before the explain? Unless there is a way to | |
| Comment by Greg Studer [ 27/Dec/12 ] | |
|
Reverted pending further discussion. | |
| Comment by auto [ 27/Dec/12 ] | |
|
Author: {u'date': u'2012-12-27T18:01:34Z', u'email': u'greg@10gen.com', u'name': u'Greg Studer'}Message: Revert " This reverts commit d06c2ff635acc548e73381d669d9f66f7e225ea8. | |
| Comment by auto [ 26/Dec/12 ] | |
|
Author: {u'date': u'2012-12-26T23:36:02Z', u'email': u'scotthernandez@gmail.com', u'name': u'Scott Hernandez'}Message: | |
| Comment by Scott Hernandez (Inactive) [ 05/Dec/12 ] | |
|
Currently this creates a query which wraps the $query and will cause a collection scan. It basically becomes this query:
|