Skip to content

Instantly share code, notes, and snippets.

@ReticentIris
Created January 27, 2017 06:02
Show Gist options
  • Save ReticentIris/ce5b26bcf12472078d444b3fa1617afb to your computer and use it in GitHub Desktop.
Save ReticentIris/ce5b26bcf12472078d444b3fa1617afb to your computer and use it in GitHub Desktop.
function _next(guild){
_ensureMongo();
return new Promise((resolve, reject) => {
mongo.collection(`guilds`).findAndModify(
{guildID: guild},
[[`_id`, `asc`]],
{
$pop: {
playlist: -1
}
},
{},
(err, res) => {
if(err){
return reject(err);
}
resolve(res[0]);
}
);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment