{"id":1933,"date":"2014-02-04T14:55:29","date_gmt":"2014-02-04T10:55:29","guid":{"rendered":"http:\/\/sandalov.org\/blog\/?p=1933"},"modified":"2014-02-04T14:55:29","modified_gmt":"2014-02-04T10:55:29","slug":"mongodb-importexport-via-stdin-stdout","status":"publish","type":"post","link":"https:\/\/sandalov.org\/blog\/1933\/","title":{"rendered":"Mongodb import\/export via stdin-stdout"},"content":{"rendered":"<div class=\"2d836d85a73757df15d0de19d7bef594\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-2287684400845931\";\r\n\/* valerymorozov *\/\r\ngoogle_ad_slot = \"5606708872\";\r\ngoogle_ad_width = 728;\r\ngoogle_ad_height = 90;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n<p>In the next example, mongoimport takes data passed to it on standard input (i.e. with a | pipe.)<br \/>\nWithout the output specification (i.e. &#8220;-o collection.json&#8221;), mongoexport writes output to standard output (i.e. &#8220;stdout&#8221;).<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\r\nmongoexport -d dbname -c colname | gzip &gt; dump.txt.gz\r\nzcat dump.txt.gz | mongoimport -d dbname -c colname\r\n<\/pre>\n<div class=\"2d836d85a73757df15d0de19d7bef594\" data-index=\"1\" style=\"float: none; margin:10px 0 10px 0; text-align:center;\">\n<script type=\"text\/javascript\"><!--\r\ngoogle_ad_client = \"ca-pub-2287684400845931\";\r\n\/* valerymorozov *\/\r\ngoogle_ad_slot = \"5606708872\";\r\ngoogle_ad_width = 728;\r\ngoogle_ad_height = 90;\r\n\/\/-->\r\n<\/script>\r\n<script type=\"text\/javascript\"\r\nsrc=\"http:\/\/pagead2.googlesyndication.com\/pagead\/show_ads.js\">\r\n<\/script>\n<\/div>\n\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>In the next example, mongoimport takes data passed to it on standard input (i.e. with a | pipe.) Without the output specification (i.e. &#8220;-o collection.json&#8221;), mongoexport writes output to standard output (i.e. &#8220;stdout&#8221;). mongoexport -d dbname -c colname | gzip &gt; dump.txt.gz zcat dump.txt.gz | mongoimport -d dbname -c colname<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1933","post","type-post","status-publish","format-standard","hentry","category-unsorted"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts\/1933","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/comments?post=1933"}],"version-history":[{"count":5,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts\/1933\/revisions"}],"predecessor-version":[{"id":1938,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/posts\/1933\/revisions\/1938"}],"wp:attachment":[{"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/media?parent=1933"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/categories?post=1933"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sandalov.org\/blog\/wp-json\/wp\/v2\/tags?post=1933"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}