mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
20 lines
556 B
TypeScript
20 lines
556 B
TypeScript
/// <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, {});
|