投稿

4月, 2016の投稿を表示しています

MongoDB 検索結果をファイルに出力

短い js の場合 mongo 127.0.0.1/db --eval "var c = db.collection.find(); while(c.hasNext()) {printjson(c.next())}" >> test.txt js ファイルを使用する場合 mongo 127.0.0.1/db script.js >> test.txt 最も簡単なコマンド mongoexport -h mongo.dev.priv -d models -c profiles -q '{ $query : { _id : "MRD461000" } }' -o MRD_Series1.json 【参考したサイト】 http://stackoverflow.com/questions/12823990/how-to-get-mongo-command-results-in-to-a-flat-file