List all values of a certain field in mongodb
Solution 1:
db.collection.distinct('x')
should give you an array of unique values for that field.
Solution 2:
This would return an array of docs, containing just it's x value...
db.collection.find(
{ },
{ x: 1, y: 0, _id:0 }
)