Incremental queries on associated objects #5737
Replies: 3 comments
-
Hi @mattparlane , thank you for reporting this. I've added a ticket to our tracking system here, if you'd like to follow along: https://jira.mongodb.org/browse/MONGOID-5697 |
Beta Was this translation helpful? Give feedback.
-
Hello @mattparlane, I spent some time looking into this. Firstly, I just want to point out that the example you gave would--even in the absense of existing bugs in Mongoid--probably not return the results you are looking for. You're asking for "all members of The magic incantation that gives you that query is: band.
members.
where(active: true).or(
band.
members.
where(retired: true)
) This mirrors the same semantics as ActiveRecord's Now, one issue here is that Mongoid lets you pass a query hash to the Now, whether Mongoid should support that same constraint or not, I'm not sure. I'll talk to the team about it, and perhaps we'll wind up prioritizing some changes to Mongoid so that the For now, hopefully the query I mentioned above will do the job for you. |
Beta Was this translation helpful? Give feedback.
-
Hey @jamis, thanks for getting back to me. Totally understand what you're saying, and thanks for the query. I'll leave it with you guys as to where to take it from here. Thanks again. |
Beta Was this translation helpful? Give feedback.
-
Hi!
I was trying to do an incremental
or
query on an associated object, and the resulting query was not what I expected, and I wondered if it was intentional.I was expecting the
band_id
criteria to be added to each of the array elements. Is there any way to do what I'm looking for? Or would this be considered a bug?Thanks!
Beta Was this translation helpful? Give feedback.
All reactions