Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9070637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:43:53+00:00 2026-06-16T17:43:53+00:00

I am new to mongoDB and pymongo, trying to learn how to load and

  • 0

I am new to mongoDB and pymongo, trying to learn how to load and save databases from/to disk so that I can carry it around, to send it to people etc. I’ve read the tutorial on http://api.mongodb.org/python/current/tutorial.html but couldn’t find useful information about saving and loading a db.

Assuming we create a database like:

import pymongo
mongo = pymongo.Connection()
db = mongo['my_db']
col = db['my_col']
col.insert({'name': 'Adam','occupation': 'student'})
col.insert({'name': 'John','occupation': 'officer'})
#how can we save the database to disk after this point 
#and later read it from another program?
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T17:43:54+00:00Added an answer on June 16, 2026 at 5:43 pm

    MongoDB files are portable and there are a couple of ways to achieve what you are looking for:

    • Copy the data directory for mongod to another computer. This directory is normally based in /data/db/mongodb. On the other computer you would simply replace the remote directory with the one you copied and restart the remote mongod at which point you will have the data on their system. As far as I know MongoDB has no hot swap feature here whereby you can switch, on-demand, the directories without downtime.

    • Make hot backups of your data and use MongoDBs export and import functions to select subsets of data to place onto the remote machine. You would do hot backup via mongodump and mongorestore. You can find the general doc page on that here: http://docs.mongodb.org/manual/administration/backups/#using-binary-database-dumps-for-backups

    • Make CSV/JSON exports of your data and import it onto the remote computer. This is a lot like the binary backups in this particular scenario except they are also more readable to end parties etc. I should also note that this method only inserts, it is the same as a batch insert client side iterating (in something like PHP) a CSV and calling a batch insert on the MongoDB server. You can find more information about mongoexport and mongoimport (the programs that do this) here: http://docs.mongodb.org/manual/administration/import-export/

    You can also find nice general information that relates to backing up data and moving it and restoring it on foreign machines here: http://docs.mongodb.org/manual/administration/backups/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am new to MongoDB. Anyway, I am trying to save some data that
I'm new on mongoDB and the point is, that we new realize an bug
I'm new to MongoDB and trying out some fundamentals, but this astonished me. I'm
I am making a new application in MongoDB, and I have found that the
First to say that I'm new to MongoDb and document oriented db's in general.
I'm attempting to use the new mongodb aggregation framework from php. I'm using mongod
I'm trying to parse a very large chunk of data into a new MongoDB
I'm new to MongoDB and trying to make sure I set up the proper
I'm faily new to MongoDB, and trying to filter a price within a range.
I'm new in MongoDB and I'm trying to work with aggregations. I partially do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.