mogollar
mogollar copied to clipboard
Improve records view
- This will probably require a custom records view.
- Just like in MongoHub, the records view should be a 3-column grid whereas the first column are keys, the second column are values, and the third column are types.
- Rows should alternate in background color.
- cmd+backspace key combination should delete the document
- cmd+c should copy the entire document JSON
- double click should open a modal to display the document in an editable format for easier/partial c/p.

@dashersw I have a question regarding how to retrieve data types. From the screenshot you posted, I assume that we need BSON data types. mongoose
does not provide a way of accessing underlying BSON
data types. I also couldn't find a way to access these data types via the native driver. MongoDB has an extended JSON spec (https://github.com/mongodb/specifications/blob/master/source/extended-json.rst) but that seems to work more on the inserting or filtering part of queries, rather than evaluating a find query result. I've tried to use BSON parser (https://www.npmjs.com/package/bson#EJSON), which supports extended json deserialization but I couldn't get the underlying BSON
types from that either.
Oh I wasn't worried about BSON data types — but for each property we print, we should check whether they are boolean
, string
, number
, Date
, ObjectId
, Array
or Object
. I found for object id's one can do record._id._bsontype
and it returns ObjectID
. For others, regular typeof checks (or Array.isArray
and so on) should be enough?