What field type to store the facebook stream tags?

2019-08-02 19:46发布

问题:

I have created a simple facebook app and I want to store the facebook stream tags in my mysql database with stream infomation. What field type do I have to use to store the facebook stream tags?

Stream Table: https://developers.facebook.com/docs/reference/fql/stream

  • description_tags (content match with description field)
  • message_tags (content match with message field)
  • with_tags
  • tagged_ids
  • attachment

sample description with description_tags:

      "description": "Sanan Umer was tagged in Ar Arslan's photo.", 
      "description_tags": {
        "0": [
          {
            "id": 100000381150973, 
            "name": "Sanan Umer", 
            "offset": 0, 
            "length": 10, 
            "type": "user"
          }
        ], 
        "25": [
          {
            "id": 100000457967257, 
            "name": "Ar Arslan", 
            "offset": 25, 
            "length": 9, 
            "type": "user"
          }
        ]
      },

i was thinking to use TEXT field type, but wanted to double check with professionals.

pulling and retriving data for pages / user / groups / event will be faster, if stored all the data in one table. just like fb. just what i was thinking.

回答1:

You can use the BLOB type which is binary safe (so you do not need the additional steps of serializing or unserializing ) but given the structure of you data sounds like you would be much better off with a Document-oriented DB and i recommend using MongoDB or CouchDB

Using a DODB you will have more control over the date which i assume its really what you want.



回答2:

You can store it in TEXT and use serialization and unserialization.