本文介绍了如何在我的流星应用程序数据库中使用mongoimport?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我可以使用mongoimport将csv数据导入非流星mongodb数据库,但是我不知道如何将csv导入我的流星app数据库.

I'm able to use mongoimport to import csv data into a non-meteor mongodb database, but I can't figure out how to import a csv into my meteor app database.

我学习了如何为流星应用程序(meteor mongo)运行mongo shell,但无法从该shell运行mongoimport.

I learned how to run the mongo shell for my meteor app (meteor mongo) but I can't run mongoimport from the shell.

mongoimport的mongodb文档说

The mongodb docs for mongoimport says

mongoimport --db用户-集合联系人-类型csv --file/opt/backups/contacts.csv

mongoimport --db users --collection contacts --type csv --file /opt/backups/contacts.csv

但是当我运行mongod时,启动流星应用程序并运行mongoimport,它将导入到我的test数据库中,而不是我的应用程序数据库中.

But when I run mongod, start my meteor app, and run mongoimport it imports to my test database, not my app database.

我阅读了这个stackoverflow的评论:

I read this stackoverflow post comment:

但是我不知道如何连接到该实例或如何使用mongoimport命令将其定位.

But I don't understand how to connect to that instance or how to target it with the mongoimport command.

推荐答案

好像我刚刚在.无论如何,请从mongodb.org为您的操作系统(或软件包管理器,如macports)下载mongodb,并使用bin文件夹中提供的工具. mongoimport不是mongo shell中的命令,它是一个单独运行的可执行文件.

Looks like I just answered your comment in Rahuls wonderful answer. Anyway download mongodb from mongodb.org for your OS (or a package manager like macports) and use the tool provided in the bin folder. mongoimport isn't a command in the mongo shell, it's an executable that runs separately.

也不要忘记将端口放入(如果在 3000 上运行流星实例,通常是 3001 ),并且数据库通常是流星&不是用户,当您运行它

Also don't forget to put the port in (usually 3001 if you're running your meteor instance at 3000), also the db is usually meteor & not users when you run it

mongoimport -h localhost:3001 --db meteor --collection contacts --type csv --file /opt/backups/contacts.csv

这篇关于如何在我的流星应用程序数据库中使用mongoimport?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-08 02:39