|
@@ -420,7 +420,7 @@ module.exports = {
|
|
|
},
|
|
|
|
|
|
(station, next) => {
|
|
|
- db.models.station.update({ _id: stationId }, { $set: { locked: !station.locked} }, next);
|
|
|
+ db.models.station.updateOne({ _id: stationId }, { $set: { locked: !station.locked} }, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -468,7 +468,7 @@ module.exports = {
|
|
|
},
|
|
|
|
|
|
(station, next) => {
|
|
|
- db.models.station.update({_id: stationId}, {$push: {"currentSong.skipVotes": userId}}, next)
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$push: {"currentSong.skipVotes": userId}}, next)
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -564,7 +564,7 @@ module.exports = {
|
|
|
updateName: hooks.ownerRequired((session, stationId, newName, cb) => {
|
|
|
async.waterfall([
|
|
|
(next) => {
|
|
|
- db.models.station.update({_id: stationId}, {$set: {name: newName}}, {runValidators: true}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$set: {name: newName}}, {runValidators: true}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -592,7 +592,7 @@ module.exports = {
|
|
|
updateDisplayName: hooks.ownerRequired((session, stationId, newDisplayName, cb) => {
|
|
|
async.waterfall([
|
|
|
(next) => {
|
|
|
- db.models.station.update({_id: stationId}, {$set: {displayName: newDisplayName}}, {runValidators: true}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$set: {displayName: newDisplayName}}, {runValidators: true}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -620,7 +620,7 @@ module.exports = {
|
|
|
updateDescription: hooks.ownerRequired((session, stationId, newDescription, cb) => {
|
|
|
async.waterfall([
|
|
|
(next) => {
|
|
|
- db.models.station.update({_id: stationId}, {$set: {description: newDescription}}, {runValidators: true}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$set: {description: newDescription}}, {runValidators: true}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -648,7 +648,7 @@ module.exports = {
|
|
|
updatePrivacy: hooks.ownerRequired((session, stationId, newPrivacy, cb) => {
|
|
|
async.waterfall([
|
|
|
(next) => {
|
|
|
- db.models.station.update({_id: stationId}, {$set: {privacy: newPrivacy}}, {runValidators: true}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$set: {privacy: newPrivacy}}, {runValidators: true}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -682,7 +682,7 @@ module.exports = {
|
|
|
(station, next) => {
|
|
|
if (!station) return next('Station not found.');
|
|
|
if (station.partyMode === newPartyMode) return next('The party mode was already ' + ((newPartyMode) ? 'enabled.' : 'disabled.'));
|
|
|
- db.models.station.update({_id: stationId}, {$set: {partyMode: newPartyMode}}, {runValidators: true}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$set: {partyMode: newPartyMode}}, {runValidators: true}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -717,7 +717,7 @@ module.exports = {
|
|
|
(station, next) => {
|
|
|
if (!station) return next('Station not found.');
|
|
|
if (station.paused) return next('That station was already paused.');
|
|
|
- db.models.station.update({_id: stationId}, {$set: {paused: true, pausedAt: Date.now()}}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$set: {paused: true, pausedAt: Date.now()}}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -753,7 +753,7 @@ module.exports = {
|
|
|
if (!station) return next('Station not found.');
|
|
|
if (!station.paused) return next('That station is not paused.');
|
|
|
station.timePaused += (Date.now() - station.pausedAt);
|
|
|
- db.models.station.update({_id: stationId}, {$set: {paused: false}, $inc: {timePaused: Date.now() - station.pausedAt}}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$set: {paused: false}, $inc: {timePaused: Date.now() - station.pausedAt}}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -781,7 +781,7 @@ module.exports = {
|
|
|
remove: hooks.ownerRequired((session, stationId, cb) => {
|
|
|
async.waterfall([
|
|
|
(next) => {
|
|
|
- db.models.station.remove({ _id: stationId }, err => next(err));
|
|
|
+ db.models.station.removeOne({ _id: stationId }, err => next(err));
|
|
|
},
|
|
|
|
|
|
(next) => {
|
|
@@ -972,7 +972,7 @@ module.exports = {
|
|
|
},
|
|
|
|
|
|
(song, next) => {
|
|
|
- db.models.station.update({_id: stationId}, {$push: {queue: song}}, {runValidators: true}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$push: {queue: song}}, {runValidators: true}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -1019,7 +1019,7 @@ module.exports = {
|
|
|
},
|
|
|
|
|
|
(next) => {
|
|
|
- db.models.station.update({_id: stationId}, {$pull: {queue: {songId: songId}}}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$pull: {queue: {songId: songId}}}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|
|
@@ -1098,7 +1098,7 @@ module.exports = {
|
|
|
(playlist, next) => {
|
|
|
if (!playlist) return next('Playlist not found.');
|
|
|
let currentSongIndex = (playlist.songs.length > 0) ? playlist.songs.length - 1 : 0;
|
|
|
- db.models.station.update({_id: stationId}, {$set: {privatePlaylist: playlistId, currentSongIndex: currentSongIndex}}, {runValidators: true}, next);
|
|
|
+ db.models.station.updateOne({_id: stationId}, {$set: {privatePlaylist: playlistId, currentSongIndex: currentSongIndex}}, {runValidators: true}, next);
|
|
|
},
|
|
|
|
|
|
(res, next) => {
|