diff --git a/types/mongoose/mongoose-tests.ts b/types/mongoose/mongoose-tests.ts index d6f262ebf6..1416d12332 100644 --- a/types/mongoose/mongoose-tests.ts +++ b/types/mongoose/mongoose-tests.ts @@ -385,8 +385,14 @@ Animal['findByName']('fido', function(err: any, animals: any) { animalSchema.virtual('name.full').get(function () { return this.name.first + ' ' + this.name.last; }); -new mongoose.Schema({ - child: { name: String } +var childSchema = new mongoose.Schema({ name: String }); +var parentSchema = new mongoose.Schema({ + children: [childSchema], + child: childSchema, + name: { + index: true, + required: true + } }); new mongoose.Schema({ eggs: {