本文介绍了如何在远程服务器上运行mongo db脚本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在远程服务器上运行Mongo数据库脚本?

how to run a Mongo db script on a remote server?

我知道以下命令可用于此处提到的本地命令:

I know below command can be used for the same on local as mentioned here:How to execute mongo commands through shell scripts?

mongo < yourFile.js

我想在远程服务器上运行此脚本

I want to run this script on a remote server

mongodb:uri:mongodb://user:password@mongodb01d.mydomain.com:27017/mydb

mongodb:uri:mongodb://user:password@mongodb01d.mydomain.com:27017/mydb

推荐答案

在本地计算机上使用Mongo:

With Mongo on local machine :

 mongo -u <user> -p <password> mongodb01d.mydomain.com:27017/mydb <yourFile.js>

这篇关于如何在远程服务器上运行mongo db脚本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-20 22:35
查看更多