简体   繁体   English

MongoDB 作为 docker 容器 - 如何从外部文件导入文档

[英]MongoDB as docker container - how to import documents from external file

I have a mongoDB as a docker container.我有一个 mongoDB 作为 docker 容器。 I'd like to run:我想跑:

mongoimport C:\Users\Me\Desktop\tv-shows.json -d movieData -c movies --jsonArray --drop

but the path is wrong.但路径是错误的。 Should I first put my json file to the mongo container?我应该先把我的 json 文件放到 mongo 容器中吗?

How can I import my documents in my json file?如何在我的 json 文件中导入我的文档?

SO far I get the error:到目前为止,我得到了错误:

E QUERY [js] uncaught exception: SyntaxError: unexpected token: identifier: @(shell):1:12 E QUERY [js] 未捕获的异常:SyntaxError:意外令牌:标识符:@(shell):1:12

you can use mongo compass to import-export drop or do similar basic functions easily than this if you wish to drop an existing collection and import new ones.如果您希望删除现有集合并导入新集合,您可以使用 mongo compass 导入导出 drop 或执行类似的基本功能。

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM