Skip to content

Instantly share code, notes, and snippets.

@floehopper
Created January 15, 2018 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save floehopper/b576cd4b4a857575cf3543d3e4ccba0d to your computer and use it in GitHub Desktop.
Save floehopper/b576cd4b4a857575cf3543d3e4ccba0d to your computer and use it in GitHub Desktop.
Asset Manager query without/with index
{"queryPlanner"=>
{"plannerVersion"=>1,
"namespace"=>"govuk_assets_development.assets",
"indexFilterSet"=>false,
"parsedQuery"=>
{"$and"=>
[{"_type"=>{"$eq"=>"WhitehallAsset"}},
{"deleted_at"=>{"$eq"=>nil}},
{"legacy_url_path"=>{"$eq"=>"foo"}}]},
"winningPlan"=>
{"stage"=>"FETCH",
"filter"=>
{"$and"=>
[{"_type"=>{"$eq"=>"WhitehallAsset"}}, {"deleted_at"=>{"$eq"=>nil}}]},
"inputStage"=>
{"stage"=>"IXSCAN",
"keyPattern"=>{"legacy_url_path"=>1},
"indexName"=>"legacy_url_path_1",
"isMultiKey"=>false,
"multiKeyPaths"=>{"legacy_url_path"=>[]},
"isUnique"=>false,
"isSparse"=>false,
"isPartial"=>false,
"indexVersion"=>2,
"direction"=>"forward",
"indexBounds"=>{"legacy_url_path"=>["[\"foo\", \"foo\"]"]}}},
"rejectedPlans"=>[]},
"executionStats"=>
{"executionSuccess"=>true,
"nReturned"=>0,
"executionTimeMillis"=>0,
"totalKeysExamined"=>0,
"totalDocsExamined"=>0,
"executionStages"=>
{"stage"=>"FETCH",
"filter"=>
{"$and"=>
[{"_type"=>{"$eq"=>"WhitehallAsset"}}, {"deleted_at"=>{"$eq"=>nil}}]},
"nReturned"=>0,
"executionTimeMillisEstimate"=>0,
"works"=>1,
"advanced"=>0,
"needTime"=>0,
"needYield"=>0,
"saveState"=>0,
"restoreState"=>0,
"isEOF"=>1,
"invalidates"=>0,
"docsExamined"=>0,
"alreadyHasObj"=>0,
"inputStage"=>
{"stage"=>"IXSCAN",
"nReturned"=>0,
"executionTimeMillisEstimate"=>0,
"works"=>1,
"advanced"=>0,
"needTime"=>0,
"needYield"=>0,
"saveState"=>0,
"restoreState"=>0,
"isEOF"=>1,
"invalidates"=>0,
"keyPattern"=>{"legacy_url_path"=>1},
"indexName"=>"legacy_url_path_1",
"isMultiKey"=>false,
"multiKeyPaths"=>{"legacy_url_path"=>[]},
"isUnique"=>false,
"isSparse"=>false,
"isPartial"=>false,
"indexVersion"=>2,
"direction"=>"forward",
"indexBounds"=>{"legacy_url_path"=>["[\"foo\", \"foo\"]"]},
"keysExamined"=>0,
"seeks"=>1,
"dupsTested"=>0,
"dupsDropped"=>0,
"seenInvalidated"=>0}},
"allPlansExecution"=>[]},
"serverInfo"=>
{"host"=>"trooz",
"port"=>27017,
"version"=>"3.4.9",
"gitVersion"=>"876ebee8c7dd0e2d992f36a848ff4dc50ee6603e"},
"ok"=>1.0}
{"queryPlanner"=>
{"plannerVersion"=>1,
"namespace"=>"govuk_assets_development.assets",
"indexFilterSet"=>false,
"parsedQuery"=>
{"$and"=>
[{"_type"=>{"$eq"=>"WhitehallAsset"}},
{"deleted_at"=>{"$eq"=>nil}},
{"legacy_url_path"=>{"$eq"=>"foo"}}]},
"winningPlan"=>
{"stage"=>"COLLSCAN",
"filter"=>
{"$and"=>
[{"_type"=>{"$eq"=>"WhitehallAsset"}},
{"deleted_at"=>{"$eq"=>nil}},
{"legacy_url_path"=>{"$eq"=>"foo"}}]},
"direction"=>"forward"},
"rejectedPlans"=>[]},
"executionStats"=>
{"executionSuccess"=>true,
"nReturned"=>0,
"executionTimeMillis"=>39,
"totalKeysExamined"=>0,
"totalDocsExamined"=>65660,
"executionStages"=>
{"stage"=>"COLLSCAN",
"filter"=>
{"$and"=>
[{"_type"=>{"$eq"=>"WhitehallAsset"}},
{"deleted_at"=>{"$eq"=>nil}},
{"legacy_url_path"=>{"$eq"=>"foo"}}]},
"nReturned"=>0,
"executionTimeMillisEstimate"=>50,
"works"=>65662,
"advanced"=>0,
"needTime"=>65661,
"needYield"=>0,
"saveState"=>513,
"restoreState"=>513,
"isEOF"=>1,
"invalidates"=>0,
"direction"=>"forward",
"docsExamined"=>65660},
"allPlansExecution"=>[]},
"serverInfo"=>
{"host"=>"trooz",
"port"=>27017,
"version"=>"3.4.9",
"gitVersion"=>"876ebee8c7dd0e2d992f36a848ff4dc50ee6603e"},
"ok"=>1.0}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment