|
@@ -1892,17 +1892,7 @@ export default {
|
|
|
(songsFound, next) => {
|
|
|
const query = {};
|
|
|
if (method === "add") {
|
|
|
- songModel.updateMany(
|
|
|
- { _id: { $in: songsFound } },
|
|
|
- { $pullAll: { genres } },
|
|
|
- { runValidators: true },
|
|
|
- err => {
|
|
|
- if (err) {
|
|
|
- next(err);
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
- query.$push = { genres: { $each: genres } };
|
|
|
+ query.$addToSet = { genres: { $each: genres } };
|
|
|
} else if (method === "remove") {
|
|
|
query.$pullAll = { genres };
|
|
|
} else if (method === "replace") {
|
|
@@ -2000,17 +1990,7 @@ export default {
|
|
|
(songsFound, next) => {
|
|
|
const query = {};
|
|
|
if (method === "add") {
|
|
|
- songModel.updateMany(
|
|
|
- { _id: { $in: songsFound } },
|
|
|
- { $pullAll: { artists } },
|
|
|
- { runValidators: true },
|
|
|
- err => {
|
|
|
- if (err) {
|
|
|
- next(err);
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
- query.$push = { artists: { $each: artists } };
|
|
|
+ query.$addToSet = { artists: { $each: artists } };
|
|
|
} else if (method === "remove") {
|
|
|
query.$pullAll = { artists };
|
|
|
} else if (method === "replace") {
|
|
@@ -2108,17 +2088,7 @@ export default {
|
|
|
(songsFound, next) => {
|
|
|
const query = {};
|
|
|
if (method === "add") {
|
|
|
- songModel.updateMany(
|
|
|
- { _id: { $in: songsFound } },
|
|
|
- { $pullAll: { tags } },
|
|
|
- { runValidators: true },
|
|
|
- err => {
|
|
|
- if (err) {
|
|
|
- next(err);
|
|
|
- }
|
|
|
- }
|
|
|
- );
|
|
|
- query.$push = { tags: { $each: tags } };
|
|
|
+ query.$addToSet = { tags: { $each: tags } };
|
|
|
} else if (method === "remove") {
|
|
|
query.$pullAll = { tags };
|
|
|
} else if (method === "replace") {
|