Is there a query for returning all the fields (keys) that exist in a collection?
Due to the fact that MongoDB has a flexible document structure, the fields change from doc to doc in a collection, I would like to query for all the fields in a collection.
f.e. {"color":"red", "shape":"round", "radius":3}, {"color":"green", "shape":"square", "length":2, "width":3}
This docs are in the same collection. I would like the query to return - {"color", "shape", "radius", "length", "width"}
Thank you.