mogollar icon indicating copy to clipboard operation
mogollar copied to clipboard

Improve records view

Open dashersw opened this issue 4 years ago • 2 comments

  1. This will probably require a custom records view.
  2. 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.
  3. Rows should alternate in background color.
  4. cmd+backspace key combination should delete the document
  5. cmd+c should copy the entire document JSON
  6. double click should open a modal to display the document in an editable format for easier/partial c/p.
image

dashersw avatar Aug 15 '20 17:08 dashersw

@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.

emredalkiran avatar Aug 26 '20 22:08 emredalkiran

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?

dashersw avatar Aug 29 '20 11:08 dashersw