I would like to store links in a Firebase table. I want them to be unique. These links will also be referred to by other tables, so I'd prefer not to have to store the entire long URL string of a link every time I refer to it. I'm having trouble finding a way to enforce the uniqueness of links while also using a relatively short key to refer to them.
For example, given the following schema:
{
  "comments" : {
    "-JYC6EkXz5DZt7s5jFMT" : {
      "content" : "This is the first comment.",
      "createdAt" : 1412190501922,
      "link" : "http---testing-com-1-some-article",
      "userId" : 0
    },
    "-JYC6EmzCoKfYol1Ybyo" : {
      "content" : "This is a reply to the first.",
      "createdAt" : 1412190502079,
      "link" : "http---testing-com-1-some-article",
      "replyToCommentId" : "-JYC6EkXz5DZt7s5jFMT",
      "userId" : 1
    },
    "-JYC6Ep9lwdAwQbZmdYH" : {
      "content" : "This is a reply to the second.",
      "createdAt" : 1412190502218,
      "link" : "http---testing-com-1-some-article",
      "replyToCommentId" : "-JYC6EmzCoKfYol1Ybyo",
      "userId" : 0
    }
  },
  "links" : {
    "http---testing-com-1-some-article" : {
      "comments" : {
        "-JYC6EkXz5DZt7s5jFMT" : true,
        "-JYC6EmzCoKfYol1Ybyo" : true,
        "-JYC6Ep9lwdAwQbZmdYH" : true
      },
      "createdAt" : 1412190501880,
      "url" : "http://testing.com/1/some_article"
    }
  },
  "users" : [ {
    "comments" : {
      "-JYC6EkXz5DZt7s5jFMT" : true,
      "-JYC6Ep9lwdAwQbZmdYH" : true
    },
    "createdAt" : 1412190501881,
    "name" : "Joe Blow"
  }, {
    "comments" : {
      "-JYC6EmzCoKfYol1Ybyo" : true
    },
    "createdAt" : 1412190501881,
    "name" : "Jack Black"
  } ]
}
As you can see, each comment must include a long key for the link it belongs to. Is there a good way to shorten these keys while keeping uniqueness?
 
     
    