1234567891011121314151617181920212223242526272829303132333435 |
- 'use strict';
- const clone = require('../helpers/clone');
- class PopulateOptions {
- constructor(obj) {
- this._docs = {};
- if (obj == null) {
- return;
- }
- obj = clone(obj);
- Object.assign(this, obj);
- if (typeof obj.subPopulate === 'object') {
- this.populate = obj.subPopulate;
- }
- if (obj.perDocumentLimit != null && obj.limit != null) {
- throw new Error('Can not use `limit` and `perDocumentLimit` at the same time. Path: `' + obj.path + '`.');
- }
- }
- }
- module.exports = PopulateOptions;
|