I've read some questions and articles about many to many relations in the google datastore but I'm still not sure which is the most efficient way in my case: I have a User
which references N CollectionOfThings
. A CollectionOfThings
can reference M users. Both, M and N are very small. I except no more then 5. (Nature of my application). The user object is fetched almost in every request. The other object not. I need to query from an instance of CollectionOfThings
all users and from a user all instances of her CollectionOfThing
instances.
So I see to possible implementations:
CollectionOfThings
has a List of Users.User
has a collection ofCollectionOfThings
. Both ends of the relation are NOT annotated with @Load. If I need the objects of one the relatin parts I load them with ofy().load().keys();I use a relation object which I can query ofy()....filter("user", ...) and vice versa.
Now the big question is: What is the most efficient way in perspective of data store read operations?