Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-14636

Aggregation explain on uncached plan returns error "No plan available to provide stats"

    • ALL

      Running explain on an aggregation pipeline returns the error "No plan available to provide stats" if the query issued by the $cursor stage is not cached and has multiple candidate plans.

      Reproduces on 2.6.0 through 2.6.3. Does not reproduce on master.

      > db.foo.drop()
      true
      > db.foo.ensureIndex({a:1})
      {
      	"createdCollectionAutomatically" : true,
      	"numIndexesBefore" : 1,
      	"numIndexesAfter" : 2,
      	"ok" : 1
      }
      > db.foo.ensureIndex({b:1})
      {
      	"createdCollectionAutomatically" : false,
      	"numIndexesBefore" : 2,
      	"numIndexesAfter" : 3,
      	"ok" : 1
      }
      > db.foo.insert({a:1,b:2})
      WriteResult({ "nInserted" : 1 })
      > db.foo.insert({a:1,b:2})
      WriteResult({ "nInserted" : 1 })
      > db.foo.insert({a:1,b:2})
      WriteResult({ "nInserted" : 1 })
      > db.foo.aggregate([{$match: {a:1,b:1}}],{explain:true})
      {
      	"stages" : [
      		{
      			"$cursor" : {
      				"query" : {
      					"a" : 1,
      					"b" : 1
      				},
      				"planError" : "InternalError No plan available to provide stats"
      			}
      		}
      	],
      	"ok" : 1
      }
      >
      

      Originally reported on mongodb-user: <https://groups.google.com/forum/#!topic/mongodb-user/TwK0wKr45Bk>.

            Assignee:
            ian@mongodb.com Ian Whalen (Inactive)
            Reporter:
            rassi J Rassi
            Votes:
            6 Vote for this issue
            Watchers:
            19 Start watching this issue

              Created:
              Updated:
              Resolved: