You can use db.collection.distinct
to get back an array of unique values:
> db.test.distinct("name")
[ "my_name", "john" ]
More Related Contents:
- Find document with array that contains a specific value
- Update field in exact element array in MongoDB
- Mongodb sort inner array
- Return only matched sub-document elements within a nested array
- Auto increment in MongoDB to store sequence of Unique User ID
- MongoDB Aggregation: How to get total records count?
- Average Aggregation Queries in Meteor
- Querying an array of arrays in MongoDB
- Is there any option to limit mongodb memory usage?
- mongo group query how to keep fields
- Auto compact the deleted space in mongodb?
- $unwind empty array
- How do I start Mongo DB from Windows?
- Find all duplicate documents in a MongoDB collection by a key field
- MongoDB $gt/$lt operators with prices stored as strings
- Couldn’t connect to server 127.0.0.1:27017
- Is GridFS fast and reliable enough for production?
- Dealing with schema changes in Mongoose
- Batch insert/update using Mongoid?
- Using stored JavaScript functions in the Aggregation pipeline, MapReduce or runCommand
- MongoDB – The argument to $size must be an Array, but was of type: EOO / missing
- Build a reactive publication with additional fields in each document
- How to flatten a subdocument into root level in MongoDB?
- Push to two separate arrays in one update call in mongodb
- How to toggle a boolean field in one document with atomic operation?
- How to delete documents by query efficiently in mongo?
- Update embedded object inside array inside array in MongoDB
- How to check if an array field contains a unique value or another array in MongoDB?
- MongoDB index/RAM relationship
- mongodb aggregate query isn’t returning proper sum on using $sum