These are chat archives for Automattic/mongoose

4th
May 2018
Daniel Netzer
@DanielNetzer
May 04 2018 15:33
morning/evening all
I have a question, assuming I have a document with an array of objects something like this
...
products: [{
        details: {
            platformId: String,
...
how can I find all documents that have a product in them with the platformId?
Nate Mallison
@NJM8
May 04 2018 15:41
@DanielNetzer do you mean all products with a specific platformID?
I would think you can just filter it in your query
Daniel Netzer
@DanielNetzer
May 04 2018 15:49
$pull: { 'products.details.platformId': productId.toString() }
did the trick for me, I had to remove them from the document