Update query.py

Using list was a performance issue because it was calling __len__ which caused a .count() call to MongoDB.