Failed: open http://fromtheramp.com/temp/country.csv: no such file or directory
我在localhost上使用了import funtionality并且工作正常。但现在,它无法在服务器上运行。 它给了我以下错误。
[Route("Teams")]
public ActionResult Teams()
And then I have actions to return data :
//GET : api/Teams
[Route("api/Teams")]
[HttpGet("GetAllTeams")]
public IEnumerable<Team> GetAllTeams()
//GET : api/Teams/5
[Route("api/Teams/{teamId:int}")]
[HttpGet("{teamId:int}", Name = "GetTeamById")]
public IActionResult GetTeamById(int teamId)
//GET : api/Teams/Chicago Bears
[Route("api/Teams/{teamName}")]
[HttpGet("{teamName}", Name = "GetTeamByName")]
public IActionResult GetTeamByName(string teamName)
//POST : api/Teams
[Route("api/Teams/{team}")]
[HttpPost("{team}", Name = "AddTeam")]
public void AddTeam([FromBody]Team item)
//PUT: api/Teams
[Route("api/Teams/{team}")]
[HttpPut("{team}", Name = "EditTeam")]
public void EditTeam([FromBody]Team item)
//DELETE : api/Teams/4
[Route("api/Teams/{teamId:int}")]
[HttpDelete("{teamId:int}", Name="DeleteTeam")]
public IActionResult DeleteTeam(int id)
答案 0 :(得分:1)
mongoimport
实用程序无法与您尝试执行的URI资源等外部文件源一起使用。
为了做你想做的事,&#34; pipe&#34;另一个命令(如curl
到mongoimport
的输入改为:
curl http://fromtheramp.com/temp/country.csv | \
mongoimport -d ramp -c country --type csv --headerline
mongoimport
和mongoexport
都默认使用STDIN / STDOUT,除非您包含--file
等选项。所以省略它并改为使用STDIN。
作为非csv示例(虽然适用相同的原则),您可以使用可公开访问的mongodb示例数据集作为测试:
curl https://raw.githubusercontent.com/mongodb/docs-assets/primer-dataset/dataset.json | \
mongoimport -d test -c restaurants --drop
哪个hapilly导入了这些数据,并且比manual page更有效地建议你这样做。虽然您可能需要本地副本进行测试。