Hello,
I’m using Meteor and Mongodb.
Considering the data structure:
{
"_id": "myid",
"userId": "currentuserid",
"username": "myuser",
"app": {
"twitter": [],
"rss": [
{
"url": "https://www.example1.com/rss",
"_id": "id1site1",
"feed": [
{ "data": "this is article 31267218", "guid": { "_text": "31267218" } },
{ "data": "this is article 31259997", "guid": { "_text": "31259997" } }
]
},
{
"url": "https://www.example2.com/rss",
"_id": "id2site2",
"feed": [
{ "data": "this is article 44446355", "guid": { "_text": "44446355" } },
{ "data": "this is article 44433222", "guid": { "_text": "44433222" } }
]
}
]
}
}
For example, _id=“id2site2” and guid=“44446355” as parameter,
i’m using this command:
let distinct = await UsersAppDB.rawCollection().distinct("app.rss.feed",
{
"userId": "currentuserid",
"app.rss._id": "id2site2",
"app.rss.feed.guid._text": { $eq: "44446355" }
}
)
but this doesn’t return the correct result.
i would like to return this:
{ "data": "this is article 44446355", "guid": { "_text": "44446355" } },
Next is to set a new field {visible: true} in this part of the data:
{ "data": "this is article 44446355", "guid": { "_text": "44446355" }, visible: true },
How to update the data?
Thank you for helping