How would you design an AppEngine datastore for a social site like Twitter?

后端 未结 4 1372
野性不改
野性不改 2020-12-12 09:41

I\'m wondering what would be the best way to design a social application where members make activities and follow other member\'s activities using Google AppEngine.

4条回答
  •  天涯浪人
    2020-12-12 10:14

    I think this can now be solved with the new Projection Queries in NDB.

    class Message(ndb.Model):
        sender = ndb.StringProperty()
        receivers = ndb.StringProperty(repeated=True)
        body = ndb.TextProperty()
    
    messages = Message.query(Message.receivers == user_id).fetch(projection=[Message.body])
    

    Now you don't have to deal with the expensive cost of deserializing the list property.

提交回复
热议问题