
David Ennis (Clever Llamas) asked a question.
Badly written andQuery trap
HI. Perhaps its my fat fingers. Perhaps its the fact that I cannot type or because I simply type and think at different rates.
Regardless, I did this again recently and could not figure out what was wrong to save my life:
I wrote this:
- const query = //some query that Iknow matches only 10% of my database
- cts.estimate(cts.andQuery[query])
The end result was the count of my entire database and not just the fragments in scope of my query. Then I remembered running into this with my typos at another time about a year ago and I proved the oddity this way:
- //just a happily resolved query- and valid JavaScript so IDEs and the like don't catch it
- cts.andQuery[cts.falseQuery()] // return all fragments in scope
So, be careful if you are prone to type silly things like me.
A more in-depth explanation of the "why" can be found here
This is a nice one, a much higher class of typo than what I usually manage!