Add mongoose-deep-populate.d.ts

This commit is contained in:
Aya Morisawa 2015-11-22 14:19:12 +09:00
parent 0ea013a775
commit a8a7d043c8
2 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,19 @@
/// <reference path="../mongoose/mongoose.d.ts" />
/// <reference path="./mongoose-deep-populate.d.ts" />
import mongooseDeepPopulate from 'mongoose-deep-populate';
import * as mongoose from 'mongoose';
import { Schema } from 'mongoose';
var connection = mongoose.connect("mongodb://localhost/myDatabase");
var deepPopulate = mongooseDeepPopulate(connection);
var bookSchema = new Schema({
author: { type: Schema.Types.ObjectId, ref: 'Author' },
title: String,
genre: String,
publishDate: Date
});
bookSchema.plugin(deepPopulate, {});

View File

@ -0,0 +1,12 @@
// Type definitions for mongoose-deep-populate 2.0.3
// Project: https://github.com/buunguyen/mongoose-deep-populate
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../mongoose/mongoose.d.ts" />
declare module "mongoose-deep-populate" {
import { Mongoose, Schema } from 'mongoose';
export default function(mognoose: Mongoose): (schema: Schema, options: Object) => void;
}