{"id":10338,"date":"2023-08-29T19:46:37","date_gmt":"2023-08-30T00:46:37","guid":{"rendered":"https:\/\/www.rushworth.us\/lisa\/?p=10338"},"modified":"2023-09-06T09:01:54","modified_gmt":"2023-09-06T14:01:54","slug":"backing-up-and-restoring-all-data-in-mongodb","status":"publish","type":"post","link":"https:\/\/www.rushworth.us\/lisa\/?p=10338","title":{"rendered":"Backing up (and restoring) *All* Data in MongoDB"},"content":{"rendered":"<p>The documentation on Mongo&#8217;s website tells you to use mongodump with a username, password, destination, and <em>which database you want to back up<\/em>. Except I wanted to back up and restore <em>everything<\/em>. Users, multiple databases, I don&#8217;t really know what else is in there hence I want <em>everything<\/em> instead of enumerating the things I want.<\/p>\n<p>Turns out you can just omit the database name and it dumps everything<\/p>\n<pre class=\"wp-block-code\"><code>mongodump --uri=\"mongodb:\/\/&lt;host URL\/IP&gt;:&lt;Port&gt;\" -u $STRMONGODBUSER -p $STRMONGODBPASS<\/code><\/pre>\n<p>And restore with<\/p>\n<pre class=\"wp-block-code\"><code>mongorestore --uri=\"mongodb:\/\/&lt;host URL\/IP&gt;:&lt;Port&gt;\"<\/code><\/pre>\n<p>Since it&#8217;s a blank slate with no authentication or users defined yet.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The documentation on Mongo&#8217;s website tells you to use mongodump with a username, password, destination, and which database you want to back up. Except I wanted to back up and restore everything. Users, multiple databases, I don&#8217;t really know what else is in there hence I want everything instead of enumerating the things I want. &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1907],"tags":[429],"class_list":["post-10338","post","type-post","status-publish","format-standard","hentry","category-mongodb","tag-mongodb"],"_links":{"self":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=10338"}],"version-history":[{"count":1,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10338\/revisions"}],"predecessor-version":[{"id":10339,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=\/wp\/v2\/posts\/10338\/revisions\/10339"}],"wp:attachment":[{"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=10338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=10338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rushworth.us\/lisa\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=10338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}