mirror of
https://github.com/wassname/talk.git
synced 2026-07-01 07:46:22 +08:00
Change add,removeTag in CommentsService to use simpler query then elemMatch
This commit is contained in:
@@ -59,7 +59,7 @@ module.exports = class CommentsService {
|
||||
|
||||
const filter = {
|
||||
id,
|
||||
tags: {$not: {$elemMatch: {name}}}
|
||||
'tags.name': {$ne: name},
|
||||
};
|
||||
const update = {
|
||||
$push: {tags: {
|
||||
@@ -101,7 +101,7 @@ module.exports = class CommentsService {
|
||||
static removeTag(id, name) {
|
||||
const filter = {
|
||||
id,
|
||||
tags: {$elemMatch: {name}}
|
||||
'tags.name': name,
|
||||
};
|
||||
const update = {$pull: {tags: {name}}};
|
||||
return CommentModel.update(filter, update)
|
||||
|
||||
Reference in New Issue
Block a user