mongoose $push, $each, results in duplicates

Viewed 81

Syntax:

{
  $push: { keywords: { $each: req.body.keywords }}
},

Data:

req.body.keywords

contents:

"keywords": ["windows","cybersecurity","passwords","chrome","security"]

Action:

findOneAndUpdate({}).clone();

Without the clone() at the end, just errors happen.

PROBLEM: Duplicate keywords.

0 Answers
Related