- createDocument(model, data, populateFields?): Promise<Document<any, any, any> & {
_id: ObjectId;
}>
-
Parameters
-
model: Model<Document<any, any, any>, {}, {}, {}, any>
-
data: any
-
populateFields: string[] = []
Returns Promise<Document<any, any, any> & {
_id: ObjectId;
}>
created document
Create a document in mongodb
Throws
mongoose error
Example
Example
if you want to populate fields.