Skip to content

Add a .table() function to a mongo cursor in the shell, giving a layout much like MySQL's table view

License

Notifications You must be signed in to change notification settings

cswanson310/mongo-table-view

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongo-table-view

#Overview

This module adds a .table() function to the mongo cursor in the shell, giving a layout much like MySQL's table view:

> db.foo.insert({
    type: 'demoDocument',
    metadata: { sub: 'document', two: 'fields'},
    arrayField: [1,2,'string']
})
> db.foo.insert({
    type: 'demoDocument2',
    metadata: { sub: 'doc', two: 'xx'},
    arrayField: [0, 2],
    other: 'A very long string. It goes on and on and on and on and on and on.......'
})

Unicode table Or, if you prefer the ascii style: Ascii table

The method works on any type of cursor, so you can still add any sorting, skipping, or limiting you need to.

Note: to prevent the table from getting exceedingly wide, field widths are capped, as seen above. Overflow is wrapped.

#Installation

  1. Setup
  • In POSIX environments, run make

  • In WinX environments, please add mongorc.js to your MongoDB installation folder (if it doesn't exist) and copy the contents of index.js into it, amending setting the __CURDIR global to the full path of this mongo-table-view folder.

  1. Next time you enter the mongo shell, the .table() method will be available on all cursors.

About

Add a .table() function to a mongo cursor in the shell, giving a layout much like MySQL's table view

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published