Skip to content

Commit 1563a1b

Browse files
committed
docs(document): improve $assertPopulated() docs
1 parent d87e627 commit 1563a1b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/document.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4417,8 +4417,13 @@ Document.prototype.$populated = Document.prototype.populated;
44174417
* doc.$assertPopulated('author'); // does not throw
44184418
* doc.$assertPopulated('other path'); // throws an error
44194419
*
4420+
* // Manually populate and assert in one call. The following does
4421+
* // `doc.$set({ likes })` before asserting.
4422+
* doc.$assertPopulated('likes', { likes });
44204423
*
4421-
* @param {String|String[]} path
4424+
*
4425+
* @param {String|String[]} path path or array of paths to check. `$assertPopulated` throws if any of the given paths is not populated.
4426+
* @param {Object} [values] optional values to `$set()`. Convenient if you want to manually populate a path and assert that the path was populated in 1 call.
44224427
* @return {Document} this
44234428
* @memberOf Document
44244429
* @method $assertPopulated

0 commit comments

Comments
 (0)