MongoDB return all documents by field without duplicates?

Is there any way in the mongo shell I can return all documents in a collection, but order them by a specific field and remove any documents with fields the same as other documents?



For sort I would use sort. To remove document with same value: distict.

Something like:

db.collection.find().sort({field : 1}).distinct('field')

Need Your Help

How to extract ONLY the contents of the JDK installer

installer installation extract java

I just downloaded the Java SDK/JDK versions 5 and 6, and I just need the development tools (and some libraries) contained in the installation packages, I don't need to perform an installation and t...