diff --git a/lib/document.js b/lib/document.js index 73e2fdedbb6..1a6e7be05f5 100644 --- a/lib/document.js +++ b/lib/document.js @@ -4655,7 +4655,7 @@ Document.prototype.getChanges = function() { * Returns a copy of this document with a deep clone of `_doc` and `$__`. * * @return {Document} a copy of this document - * @api private + * @api public * @method $clone * @memberOf Document * @instance diff --git a/types/document.d.ts b/types/document.d.ts index 0d8f085def3..f43db5c34c8 100644 --- a/types/document.d.ts +++ b/types/document.d.ts @@ -28,6 +28,9 @@ declare module 'mongoose' { /** Assert that a given path or paths is populated. Throws an error if not populated. */ $assertPopulated(path: string | string[], values?: Partial): Omit & Paths; + /** Returns a deep clone of this document */ + $clone(): this; + /* Get all subdocs (by bfs) */ $getAllSubdocs(): Document[];