Re: Find duplicates in array field

From: Szaniszlo Szöke <szoke.szaniszlo@xxxxxxxxx>
To: mongodb-user <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Tue, 26 Apr 2016 00:48:36 -0700 (PDT)
Why ads?
Thanks for the advise.
I tried a bunch of different syntax, like this one:

{"$group" : { _id: "$arrayElemAt:[$a1, 0]", "count": { "$sum": 1 } } }
{"$match": {"count" : {"$gt": 1} } }
{"$project": {"arrayElemAt:[$a1, 0]" : "$_id", "_id" : 1} }

to no avail. I can't get the number of documents having one precise element 
of array a1 duplicated (in this sample the first one, could be any other 
one).

Any idea ?

-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/b9fe984f-216f-4173-a7b9-8232690d1d44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?