Sorry if this question is too simple; I\'m only entering 9th grade.
I\'m trying to learn about NoSQL database design. I want to design a Google Datastore model that min
What about:
from google.appengine.ext import ndb
class Comment(ndb.Model):
various properties...
class BlogPost(ndb.Model):
comments = ndb.KeyProperty(Comment, repeated=True)
various other properties...
This way, you can store up to 5000 comments per blog post (the maximum number of repeated properties) independent of the size of each blog post. You won't need a query to fetch the blogs for a comment, you can just do ndb.get_multi(blog_post.comments)
. And for this operation, you can try to rely on ndb's memcache. Of course, it depends on your use case whether this is a good assumption or not.