Server IP : 162.213.251.212 / Your IP : 3.129.208.224 [ Web Server : LiteSpeed System : Linux business55.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : allssztx ( 535) PHP Version : 8.1.31 Disable Function : NONE Domains : 1 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/allssztx/needapair.com/node_modules/mongoose/lib/helpers/populate/ |
Upload File : |
'use strict'; /** * Set a populated virtual value on a document's `$$populatedVirtuals` value * * @param {*} populatedVirtuals A document's `$$populatedVirtuals` * @param {*} name The virtual name * @param {*} v The result of the populate query * @param {*} options The populate options. This function handles `justOne` and `count` options. * @returns {Array<Document>|Document|Object|Array<Object>} the populated virtual value that was set */ module.exports = function setPopulatedVirtualValue(populatedVirtuals, name, v, options) { if (options.justOne || options.count) { populatedVirtuals[name] = Array.isArray(v) ? v[0] : v; if (typeof populatedVirtuals[name] !== 'object') { populatedVirtuals[name] = options.count ? v : null; } } else { populatedVirtuals[name] = Array.isArray(v) ? v : v == null ? [] : [v]; populatedVirtuals[name] = populatedVirtuals[name].filter(function(doc) { return doc && typeof doc === 'object'; }); } return populatedVirtuals[name]; };