Friday 5 May 2017

How can I remove duplicates from Firebase database when nodes share a common child?

"-Kj9Penv_LMRUIPSet0b" : {
  "categories" : [ "food", "fashion"],
  "contact" : "profile/contact/eieiiieie888x7ww28288_x22",
  "location" : "New York, United States",
  "name" : "Billybob Smith",
  "social" : {
    "twitter" : {
      "followers" : "1,002",
      "nickname" : "@billybob"
    }
  },
  "state" : "0"
},
"eieiiieie888x7ww28288_x22" : {
  "categories" : [ "food", "fashion" ],
  "contact" : "profile/contact/eieiiieie888x7ww28288_x22",
  "location" : "New York, United States",
  "name" : "Billybob Smith.",
  "social" : {
    "twitter" : {
      "followers" : "1,002",
      "nickname" : "@billybob"
    }
  },
  "socialID" : "twitter_id|558969977",
  "state" : "0",
  "uniqueID" : "eieiiieie888x7ww2828"
},

This is one .JSON example of a duplicate in my database. I have a lot of duplicates in my database. The only common piece of data I capture which uniquely identifies each user is their contact link. What is my best course of action to seek and remove duplicates from my database? I'm totally stuck. The second entry example is the more accurate and complete entry. Ideally, I could remove the first one and leave the second one behind.

Could really use some help here! Thank you so much!



via ryangineer

No comments:

Post a Comment