I have documents with nested seller as shown below:
{
name: Product A,
sellers: [
{id: 1011},
{id: 2020}
]
},
{
name: Product B,
sellers: [
{id: 1011},
{id: 6050}
]
},
{
name: Product C,
sellers: [
{id: 3013}
]
},
{
name: Product D,
sellers: [
{id: 4050},
{id: 5051}
]
}
I have a blacklist of sellers. For example, the seller with id=1011 and id=2020 are blacklisted.
How can I get only products that have at least one trusted seller?
I want a return as show below:
{
name: Product B,
sellers: [
{id: 6050}
]
},
{
name: Product C,
sellers: [
{id: 3013}
]
},
{
name: Product D,
sellers: [
{id: 4050},
{id: 5051}
]
}
The "Product A" must not appear because it does not have any trusted seller.
The "Product B" must appear (because has one trusted seller) but excluding the seller with id=1011 (it is blacklisted)