Mongoose - Self-referential deep populate error

I'm trying to populate a self-referential model a few times recursively. Here's my schema:

var TestSchema = new Schema({
  title: { type: String },
  counter: { type: Number },
  children: [ { type: Schema.Types.ObjectId, ref: 'test' } ]
});
var models = {
  Test: mongoose.model('test', TestSchema)
};

So far, this functioning code populates everything one level:

models.Test.find().populate('children').exec(function(err, doc) {
  if (err)
    res.send(err);
  else {
    res.send(doc);
  }     });

But when I try to do something like:

models.Test.find().populate('children').populate('children.children').exec(function(err, doc) {

or even:

models.Test.find().populate('children').exec(function(err, doc) {
  if (err)
    res.send(err);
  else {
    models.Test.populate(doc, 'children.children', function(err, doc) {
       res.send(doc);
    });
  }
});

I get this error:

TypeError: Cannot call method 'path' of undefined
    at search (..../api/node_modules/mongoose/lib/model.js:2059:28)
    at search (..../api/node_modules/mongoose/lib/model.js:2078:22)
    at Function._getSchema (..../api/node_modules/mongoose/lib/model.js:2085:5)
    at populate (..../api/node_modules/mongoose/lib/model.js:1706:22)
    at Function.Model.populate (..../api/node_modules/mongoose/lib/model.js:1686:5)
    at Promise.<anonymous> (..../api/api.js:22:19)
    at Promise.<anonymous> (..../api/node_modules/mongoose/node_modules/mpromise/lib/promise.js:162:8)
    at Promise.EventEmitter.emit (events.js:95:17)
    at Promise.emit (..../api/node_modules/mongoose/node_modules/mpromise/lib/promise.js:79:38)
    at Promise.fulfill (..../api/node_modules/mongoose/node_modules/mpromise/lib/promise.js:92:20)

The mongoose 3.6 release notes say that deep populates are allowed using Model.populate, but that's giving me an error. Does anyone know what's going on?

The Mongoose docs for the Model.populate method states that the second parameter should be an options object, and not a string.

Here's the example they provide:

User.findById(id, function (err, user) {
  var opts = [
      { path: 'company', match: { x: 1 }, select: 'name' }
    , { path: 'notes', options: { limit: 10 }, model: 'override' }
  ]

  User.populate(user, opts, function (err, user) {
    console.log(user);
  })
})

So yours should look something like:

models.Test.find().populate('children').exec(function(err, doc) {
  if (err)
    res.send(err);
  else {
    var opts = [
      { path: 'children.children' }
    ];
    models.Test.populate(doc, opts, function(err, doc) {
       res.send(doc);
    });
  }
});