mongodb-odm icon indicating copy to clipboard operation
mongodb-odm copied to clipboard

No support for $[<identifier>] / arrayFilters right?

Open chrisdejager opened this issue 7 years ago • 7 comments

Can't seem to find any reference. Although it is part of 3.6+ ... https://docs.mongodb.com/manual/reference/operator/update/positional-filtered/

Would love to see it implemented, but I can use workarounds for now :)

chrisdejager avatar Sep 14 '18 13:09 chrisdejager

Correct, there is no support for those yet. We'll support them in 2.x once we're done with the driver switch.

alcaeus avatar Sep 17 '18 04:09 alcaeus

2 years and half later, any news about integration of arrayFilters ?

matpo avatar Jan 08 '21 12:01 matpo

Nope. I experimented using them for collection updates, but that would require a significant overhaul (read "rewrite") of the persister logic which I didn't find the time for.

Obviously, the first step would be to add support for this in the query builder. I'm interested in your use-case: what would you like to use it for, do you use it already (e.g. by sending updates through the driver itself), etc. Maybe we can find a quick way to get that into 2.2. Ironically, one of the reasons I didn't get around to building anything is that I stopped using the ODM 2 years ago when I joined MongoDB, hence my question about your use-case to come up with an API for this.

alcaeus avatar Jan 08 '21 16:01 alcaeus

Thank you for your answer.

My use case is to replace an array value with a single query (like that: https://stackoverflow.com/a/58973094/6911841). In the mean time I make two separates queries, one pull and one push, that is not very optimal.

matpo avatar Jan 08 '21 16:01 matpo

Hi, anything change in this issue pls? Thanks

spiider8 avatar Feb 22 '23 09:02 spiider8

Hi accually right now there is only workaround array filter given as array parameter in getQuery

Alaarafeh avatar Mar 01 '23 15:03 Alaarafeh

Ok and can you show me an example of this workaround pls? Thanks

spiider8 avatar Mar 02 '23 08:03 spiider8