TylerBrock / mongo-hacker

MongoDB Shell Enhancements for Hackers
tylerbrock.github.io/mongo-hacker
MIT License
1.79k stars 235 forks source link

Better DBRef #145

Closed malarzm closed 8 years ago

malarzm commented 8 years ago

Enhances how DBRef are printed since original implementation doesn't really care about showing optional $db field not mentioning any additional fields user (or his software, in my case PHP's Doctrine ODM) may put there. Right now it looks like this (showcased all 4 combinations possible as of now, switching mongo_hacker_config.dbref.extended_info to false will bring back shell's default):

I believe styling could be improved but before I spend too much time polishing details I'd like to know whether PR will be accepted at all :)

Review on Reviewable

TylerBrock commented 8 years ago

To answer your question, yes. We would absolutely merge this.

malarzm commented 8 years ago

@TylerBrock applied your comments, any hints on stylings? Somehow I prefer having DBRef printed inline but that could probably use proper colours then...

TylerBrock commented 8 years ago

Yeah the code should delegate to shellPrint() ultimately to print the JSON objects. I didn't look closely enough at it the first time.

malarzm commented 8 years ago

Found out that tojsonObject(additional, undefined, true) will do exactly what I wanted to:

selection_003

So I believe it's ready now :)

malarzm commented 8 years ago

@TylerBrock ping? :)

TylerBrock commented 8 years ago

Love it! Thank you. Sorry for the delay.

malarzm commented 8 years ago

No worries and thanks!