Mongodb replicates databases between different hosts

  mongodb, question

I want to put a mongodb database on local windowsarticlesCopy to server, server ip assumes

I want to use mongodb’s python driver to write a python script:

from pymongo import MongoClient
 # Copy Database from windows to Server
 def local_to_server():
 client = MongoClient('localhost', 27017)
 db = client.articles
 # How should it be written here?
 if __name__ == "__main__":

What should we do?

There is no need to call it directly by script.mongodump+mongorestoreDon’t just get things done? Why write a python program?