LoginSignup
21
21

More than 5 years have passed since last update.

MongoDBをシェルで弄ることが多いならmesh使おう

Posted at

日頃業務なんかでmongodbをシェルからいじってて、「あ”ー、underscore.js使いたい」とかその他諸々機能を拡張したいなと思っている方におすすめ。

meshとは?

正式にはMongo Extended Shellという名前らしい。
以下のライブラリをまとめた便利ツールです。

導入方法

$ git clone https://github.com/skratchdot/mesh.git
$ echo 'load("<meshをcloneしたディレクトリ>/mesh/mesh.js");' >> ~/.mongorc.js 

こんだけです。

含まれるライブラリ

  • underscore.js - ご存知underscore.js
  • underscore.string.js - 文字列操作用ライブラリ
  • moment.js - 日付操作ライブラリ
  • science.js - 科学系演算用ライブラリ
  • distinct2() - あまり使ってないけど、デフォルトのdistinctコマンドより大きなコレクション数に対しても使えるdistinctコマンド
  • distinctTypes() - distinctと違って、指定したキーの型を返してくれるコマンド
  • flatten() - mapReduce使ってドキュメントをkey-value型に展開してくれる拡張。使ったこと無い。
  • schema() - A schema analysis tool for MongoDB.
  • wild() - ワイルドカード検索を可能にしてくれる

他にも色々入ってる。

その他

https://github.com/skratchdot/mesh
configとか細かく設定できるみたいなので見てみてください。

21
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
21