Be able to sort document fields alphabetically
It would be useful to be able to display columns for fields in a document in alphabetical order
-
Brian commented
Exactly what Oz says. I have some documents with 500 fields. If I want to find a specific one and edit it, I have to do a linear search through those 500 fields.
-
Oz commented
Betsy (and Marc) - The suggestion is to be able to sort the FIELDS, not the documents/results. The fields in a document are shown by the order they were inserted to the object which makes spotting fields difficult with documents that has a lot of them (especially when the order has no real meaning or additional fields are added later).
Be able to show the document with the fields in alphabetical order will make it easier to use.
-
AdminBetsy (Admin, MongoDB) commented
Hi, Marc is correct. It is possible to sort query results in alphabetical order based on a field of your choice by expanding the query options. Here is a link to our documentation on sorting in Compass: https://www.mongodb.com/docs/compass/current/query/sort/
For example, if you'd like to sort the results in alphabetical order based on a field "name", you could enter {"name": 1} as your sort.
It is not currently possible to sort documents in the table view by clicking a button while viewing the document output. However, I'm curious if modifying and re-running the query is enough? -
Marc commented
You can sort the result in the query options
-
Thomas Zäschke commented
Comparing docs from a query result with more than 2 fields per doc is not easy as the fields show in an apparently arbitrary position in each doc.
-
Nithin commented
Hello,
We have a lot of fields in a record, like 80.
It can be difficult to find a specific field when there are that many.
So, it would be helpful if you could provide an option to sort the fields in alphabetical order.
Thank you. -
Oz commented
I desperately need this functionality, we have objects with a lot of fields and it's a real pain to find a specific field in each one. Would appreciate it greatly, cheers!