Closed Enalmada closed 10 years ago
Hi Enalmada: I can't quite reproduce the error yet, but let me ask: your traceback shows the line
users = list(User.Query.filter(publisherId='15').filter(publisherId__exists='true').limit(1000).order_by("LoggedIn", descending=False))
Why filter for publisherId
existing after already filtering for publisherId
equaling 15?
You have good eyes. I was actually manipulating my existing workaround code so I could provide you an exact stacktrace. As a workaround I found that if I sort by descending false, then all the non-exist fields go to the top but makes the code smell so I figured I would look harder into getting exists working. Thanks for your help on this.
So I updated the issue with my exact real code I am trying to run. I was trying to simplify the test case which usually is a good idea but I just realized that the error is different with my full intended code. Doh. Sorry. Hopefully this error is actually easier to reproduce.
Change to __exists=False
Oh man you are right! Silly me. Thanks very much for helping me. I had a feeling I was doing something wrong on this one.
No problem: In fact your query illuminated an important failure mode (filtering for a constraint after filtering for a specific value) that I just added an informative error message for in 728c492b8f8196e8a90a5a407e28b39e84818213. Thanks for your issue!
When I try and use exists filter, I get bad type for $exists. I assume I should be doing exists='false'. Totally sorry if this is not supported or I am trying to use the exists filter wrong. I figured it would be either exists='false' or __exists=false based on my best reading of the docs.
I am trying to find all users with a publisherId of 15 that have LoggedIn as (undefined).
Sample...
Error when I do __exists='false'
Error when i do __exists=false
Raw example from REST API https://www.parse.com/docs/rest#queries-constraints
Thanks again for such a great library.