Skip to content

Commit d57c84b

Browse files
committedFeb 14, 2020
fix(queryhelpers): remove Object.values() for Node.js 4.x-6.x support
Re: #8596
1 parent a1b8308 commit d57c84b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎lib/queryhelpers.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ const clone = require('./helpers/clone');
2121
*/
2222

2323
exports.preparePopulationOptions = function preparePopulationOptions(query, options) {
24-
const pop = Object.values(query.options.populate);
24+
const _populate = query.options.populate;
25+
const pop = Object.keys(_populate).reduce((vals, key) => vals.concat([_populate[key]]), []);
2526

2627
// lean options should trickle through all queries
2728
if (options.lean != null) {
@@ -43,7 +44,8 @@ exports.preparePopulationOptions = function preparePopulationOptions(query, opti
4344
*/
4445

4546
exports.preparePopulationOptionsMQ = function preparePopulationOptionsMQ(query, options) {
46-
const pop = Object.values(query._mongooseOptions.populate);
47+
const _populate = query._mongooseOptions.populate;
48+
const pop = Object.keys(_populate).reduce((vals, key) => vals.concat([_populate[key]]), []);
4749

4850
// lean options should trickle through all queries
4951
if (options.lean != null) {

0 commit comments

Comments
 (0)
Please sign in to comment.