My document looks like this:
{
_id: "57008339e7537f033b67cf84",
title: "my title",
urls: ["1.html", "2.html", "3.html"]
}
I want to remove "2.html"
from urls
. Referencing this question I have tried following code:
db.collection("bookmarks").update({_id: "57008339e7537f033b67cf84"}, {$pull: {"urls": {$eq: "2.html"}}}, (err, result) => {
if (err) {
console.log(err);
}
});
But the output is:
{ [MongoError: unknown top level operator: $eq]
name: 'MongoError',
message: 'unknown top level operator: $eq',
driver: true,
index: 0,
code: 2,
errmsg: 'unknown top level operator: $eq' }