I am trying to publish part of a nested array of objects.
So for example for the following json document:
{
"offerName": "offer1",
"books": [{
"bookName": "Book 1",
"authors": [{
"authorName": "A"
}, {
"authorName": "B"
}, {
"authorName": "C"
}],
"bookName": "Book 2",
"authors": [{
"authorName": "A"
}, {
"authorName": "B"
}],
"bookName": "Book 3",
"authors": [{
"authorName": "A"
}]
}]
}
If I would be logged in as author B I would see the offer object because one of my books is part of the offer object…however I should not be able to see books[2]
because books[2].authors
it does not include author B…
I would like to create a publication which splices books[2]
but i am not sure how to do this on the server side inside a publication.
Even on the client side it would take three nested for loops which isnt ideal. Is is possible to use aggregation for this? Or are there better options?
Thanks
Shibbn