In mongodb I have collection where arrays has duplicate entries like
{
"_id": ObjectId("57cf3cdd5f20a3b0ba009777"),
"Chat": 6,
"string": [
"1348157031 Riyadh",
" 548275320 Mohammad Sumon",
" 1348157031 Riyadh",
" 548275320 Mohammad Sumon",
" 1348157031 Riyadh",
" 1348157031 Riyadh"
]
}
I need to remove duplicate arrays and keep only unique array values like below.
{
"_id": ObjectId("57cf3cdd5f20a3b0ba009777"),
"Chat": 6,
"string": [
"1348157031 Riyadh",
" 548275320 Mohammad Sumon",
]
}
what would be the best way to do this
thanks