Mongoimport 找不到文件?

问题描述

mongoimport --uri mongodb+srv://gtye:<PASSWORD>@dxgraph.rymok.mongodb.net/dxgraph-db --collection dxgraph-collection --type json --file ~/DxHero%20Godot/Data/postgres_export.json

返回

2021-05-25T12:58:05.538-0400    Failed: open /Users/gtye/DxHero%20Godot/Data/postgres_export.json: no such file or directory
2021-05-25T12:58:05.538-0400    0 document(s) imported successfully. 0 document(s) Failed to import.

但我知道它在那里!!

enter image description here

在这里!!到底是怎么回事?

解决方法

%20 是一种 URI 转义机制。它在 shell 中不起作用。

试试:

mongoimport --uri mongodb+srv://gtye:<PASSWORD>@dxgraph.rymok.mongodb.net/dxgraph-db --collection dxgraph-collection --type json --file ~/"DxHero Godot/Data/postgres_export.json"