Skip to content

Commit

Permalink
Squash a deprecation in our Code base (#1573)
Browse files Browse the repository at this point in the history
* Utilize this method for mongodb native... `async`/`await` with `hasNext()`/`next()` tested and can also work but part of ES6+

NOTE:
* Code looks more uniform with this method e.g. always wondered why there wasn't a final `aCallback`

Ref:
* https://stackoverflow.com/questions/25507866/how-can-i-use-a-cursor-foreach-in-mongodb-using-node-js#answer-25508173

Applies to #1516

Auto-merge
  • Loading branch information
Martii committed Jan 16, 2019
1 parent fe03d91 commit 4250e25
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions libs/modifySessions.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,11 @@ exports.findSessionData = function (aQuery, aStore, aOptions, aCallback) {

aOptions.sessionList = [];

aUserSessions.each(function (aErr, aSessionData) {
aUserSessions.forEach(function (aSessionData) {
var data = null;
var rQuery = null;

if (aErr) {
aCallback(aErr);
return;
}

if (!aSessionData) {
aCallback();
return;
}

Expand Down Expand Up @@ -340,6 +334,8 @@ exports.findSessionData = function (aQuery, aStore, aOptions, aCallback) {

}

}, function (aErr) {
aCallback(aErr); // done or err
});
});
}
Expand Down

0 comments on commit 4250e25

Please sign in to comment.