I found a bug in the mongodb datastore. In _Dynamic_RunQuery there is
this comment:
# HACK we need to get one Entity from this collection so we know what the
# property types are (because we need to construct queries that depend on
# the types of the properties)...
And we get it with:
prototype = self.__db[collection].find_one()
This fails if we do a query with a filter on a list property on a
collection where the element that find_one returns has no such
property.
For example, if we have:
=====================
class Numbers(db.Model):
values = db.ListProperty(int)
Numbers().put()
Numbers(values=[0, 1, 2, 3]).put()
Numbers(values=[4, 5, 6, 7]).put()
=====================
The first entity "Numbers" doesn't have a values property, and thus
any query that uses values will fail. I updated the test case to make
it fail on this error, but I don't know how to fix it.
Any ideas?
--
Joaquin Cuenca Abela