1 | 'use strict';
|
2 |
|
3 | const clone = require('../helpers/clone');
|
4 |
|
5 | class PopulateOptions {
|
6 | constructor(obj) {
|
7 | this._docs = {};
|
8 |
|
9 | if (obj == null) {
|
10 | return;
|
11 | }
|
12 | obj = clone(obj);
|
13 | Object.assign(this, obj);
|
14 | if (typeof obj.subPopulate === 'object') {
|
15 | this.populate = obj.subPopulate;
|
16 | }
|
17 |
|
18 |
|
19 | if (obj.perDocumentLimit != null && obj.limit != null) {
|
20 | throw new Error('Can not use `limit` and `perDocumentLimit` at the same time. Path: `' + obj.path + '`.');
|
21 | }
|
22 | }
|
23 | }
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 | module.exports = PopulateOptions; |
\ | No newline at end of file |