A
A
Anton2021-02-04 11:17:26
MongoDB
Anton, 2021-02-04 11:17:26

How to remove duplicate fields in MongoDb?

Hello.
The names collection contains shortname documents, they contain arrays, and they contain double lines, how can I remove them?
Looks like this:
db.names.shortname.0.uid: 100
db.names.shortname.1.uid: 101
db.names.shortname.2.uid: 102
db.names.shortname.3.uid: 100
db.names .shortname.4.uid: 101
db.names.shortname.5.uid: 102
The array is large, inside several documents, how can I remove duplicates from the array?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question