There is a feature of contact merge feature in an application. I am working on nodejs, rethinkdb.
I required to find duplicate contacts by first name and phone numbers. If first name or any number from phones numbers array should be match with other records then it will return as array of group of same number and name.
Work in rethinkdb is new for me, I don't know how do I do it in rethinkdb.
Document structure
[
{
"firstName":"A",
"phones":[
{"value":"9067672585"},
{"value":"9067672586"},
{"value":"9067672587"}
],
"id":"3ab630c3"
},
{
"firstName":"B",
"phones":[
{"value":"9067672515"},
{"value":"9067672526"},
{"value":"9067672537"}
],
"id":"3ab630c8"
},
{
"firstName":"D",
"phones":[
{"value":"9067672737"}
],
"id":"3ab630c7"
},
{
"firstName":"C",
"phones":[],
"id":"3ab630c9"
},
{
"firstName":"A",
"phones":[
{"value":"9067672585"},
{"value":"9067672588"},
{"value":"9067672589"}
],
"id":"3ab630c5"
}
]
Final product:
[[
{
"firstName":"A",
"phones":[
{"value":"9067672585"},
{"value":"9067672586"},
{"value":"9067672587"}
],
"id":"3ab630c3"
},
{
"firstName":"A",
"phones":[
{"value":"9067672585"},
{"value":"9067672588"},
{"value":"9067672589"}
],
"id":"3ab630c5"
}
],
[ {
"firstName":"B",
"phones":[
{"value":"9067672515"},
{"value":"9067672526"},
{"value":"9067672537"}
],
"id":"3ab630c8"
},
{
"firstName":"D",
"phones":[
{"value":"9067672737"}
],
"id":"3ab630c7"
}
]]
via Dipak chavda
No comments:
Post a Comment