用pymongo mongoimport CSV [英] mongoimport CSV with pymongo
问题描述
我找到了用于mongodb的命令,该命令可让您整体导入CSV文件: https://docs.mongodb.com/manual/reference/program/mongoimport/
像这样:
mongoimport --db用户--type csv --headerline --file /opt/backups/contacts.csv
但是,在Pymongo中似乎没有提及。它是否存在,如果存在,其语法是什么?
预先感谢解决方案
mongoimport
是一个命令-您安装的线路程序。安装MongoDB的说明(包括其工具,如mongoimport
)在这里:
> https://docs.mongodb.com/manual/administration/install-community/
完成此操作后,无论使用哪种系统,都可以从Unix shell或Windows命令提示符下执行
mongoimport
。
PyMongo是MongoDB的Python驱动程序,它允许您编写Python代码,以通过网络在MongoDB上执行查询和命令。 PyMongo与MongoDB工具(如
mongoimport
)分开。I found a command for mongodb which lets you import CSV files as a whole: https://docs.mongodb.com/manual/reference/program/mongoimport/
like this:
mongoimport --db users --type csv --headerline --file /opt/backups/contacts.csv
However, there seems to be no mention of this in Pymongo. Does it exists, and if so what is the syntax for it? Thanks in advance
解决方案
mongoimport
is a command-line program that you install. Instructions for installing MongoDB, including its tools likemongoimport
, are here:https://docs.mongodb.com/manual/administration/install-community/
Once you've done that, execute
mongoimport
from the Unix shell or Windows command prompt, whichever system you're on.PyMongo is a Python driver for MongoDB, it allows you to write Python code that executes queries and commands on MongoDB over the network. PyMongo is separate from the MongoDB tools like
mongoimport
.这篇关于用pymongo mongoimport CSV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!