From 551c0a703be38b402e17fe104f8d52203ae5930d Mon Sep 17 00:00:00 2001 From: Valeri Karpov Date: Mon, 17 Apr 2017 18:25:37 -0600 Subject: [PATCH] fix(document): add parent() function to subdocument to match array subdoc Fix #5134 --- lib/types/subdocument.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/types/subdocument.js b/lib/types/subdocument.js index 27534467285..d788686dc00 100644 --- a/lib/types/subdocument.js +++ b/lib/types/subdocument.js @@ -102,6 +102,16 @@ Subdocument.prototype.ownerDocument = function() { return this.$__.ownerDocument; }; +/** + * Returns this sub-documents parent document. + * + * @api public + */ + +Subdocument.prototype.parent = function() { + return this.$parent; +}; + /** * Null-out this subdoc *