Postgres Find Duplicate Values In Array Javascript Methods And Functions