Unable to import data to Cluster

i’m not able to import data to my Cluster… i used this command line inside the directory mflis-js
but it give me this error:

mongorestore --drop --gzip --uri "mongodb+srv://m220student:m220password@mflix-shard-00-00-1ziv4.mongodb.net:27017” data

error parsing command line options: invalid argument for flag `–uri’ (expected string): invalid syntax

i know there are similar topics like this, but they didn’t help me…

thanks to all :grinning:

3 Likes

One thing that’s missing is the “db” parameter to tell into which the restore should go. Also, is “data” a directory or a file? Or simply a placeholder in your example? Because at the mo it looks a bit off.

https://docs.mongodb.com/manual/reference/program/mongorestore/#options

I will search a bit further for you :slight_smile:

1 Like

Thanks for the reply, i copied the command line as it written in README section.
i think data is the directory of the the main mflix-js directory.
But i don’t know why the error is about "invalid argument to flag -uri (expected string)…

Instead of using the URI, could you try splitting it into the multiple fields, as shown in the manual page I linked to?

1 Like

sorry i don’t understand what you mean, can you give me an example please?
what command line would you use to import some data that are in a directory called c:\mflix-js\data in a cluster?

i don’t know what is wrong, i 'm using the command line that is written in README .

these are the instructions as written in README:

mongorestore command necessary to import the data is located below. Copy the command and use an Atlas SRV string to import the data (including username and password credentials).

Replace the SRV string below with your own:

navigate to mflix-js directory

cd mflix-js

import data into Atlas

mongorestore --drop --gzip --uri \ “mongodb+srv://m220student:m220password@<YOUR_CLUSTER_URI>” data

What is wrong in this command line i’m using to import the files?

mongorestore --drop --gzip --uri "mongodb+srv://m220student:m220password@mflix-shard-00-00-1ziv4.mongodb.net:27017” data

thanks

1 Like

hm… you use part of standart connection string? at least they begin mongodb:// (not mongodb+srv://)
why dont use short? mongodb 3.4?
and wat version mongorestore you use? (do mongorestore --version)

3 Likes

i’m using db version v4.0.3, and i used (not mongodb+srv://) because in file README of the lesson of this course is written to use this command line :

mongorestore --drop --gzip --uri \ “mongodb+srv://m220student:m220password@<YOUR_CLUSTER_URI>” data

if i use

mongorestore --drop --gzip --uri "mongodb://m220student:m220password@mflix-shard-00-00-1ziv4.mongodb.net:27017” data

instead of

mongorestore --drop --gzip --uri "mongodb+srv://m220student:m220password@mflix-shard-00-00-1ziv4.mongodb.net:27017” data

it’s hangs on … and nothing happens…
i see only this

1 Like

you sure to select this?
%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%20%D0%BE%D1%82%202019-02-14%2013-32-25

shard + port in your address say me about standart string
try this mongorestore --drop --gzip --uri “mongodb+srv://m220student:m220password@mflix-1ziv4.mongodb.net/test” data and check your data in atlas cluster

1 Like

i did but give me error

error parsing command line options: error parsing uri (“mongodb+srv://m220student:m220password@mflix-1ziv4.mongodb.net/test”): scheme must be “mongodb” or “mongodb+srv”

2019-02-14T10:47:08.951+0100 try ‘mongorestore --help’ for more information

It works for me, but from what comes to mind - I can offer to install package tools same (with me) version
%D0%A1%D0%BD%D0%B8%D0%BC%D0%BE%D0%BA%20%D1%8D%D0%BA%D1%80%D0%B0%D0%BD%D0%B0%20%D0%BE%D1%82%202019-02-14%2013-59-59

5 Likes

Thanks!!! i did it on windows but on mac still nothing… I have to see what is wrong on mac !

thanks again!

You have used different double quotes for the uri string. Please correct it.

Richard Xu

2 Likes

Heh, that could be it… or it could just be their copy/paste into these forums

1 Like

Hi Alessandro_65603,
I hope I can help you with my bad English :slight_smile: But with a decent Italian :slight_smile:
I use mac, the strings you can try are these:

Connect via the Mongo Shell:
mongo “mongodb+srv://mflix-evhot.mongodb.net/test” --username m220student

Connection suggested by the exercise
mongo mongodb+srv://m220student:m220password@mflix-evhot.mongodb.net/test?retryWrites=true

To import data
mongorestore --drop --gzip --uri mongodb+srv://m220student:m220password@mflix-evhot.mongodb.net data

I hope I have explained clearly :slight_smile:

Ciao!

2 Likes

Unfortunately @ZeroZen, none of those include the server name :slight_smile:

1 Like

@Tess_Sluijter … something has been cut from the forum: less-than sign name srv greater-than sign
:wink:
I edited the post :slight_smile:

1 Like

Thus it’s always a great idea to use that </> button in the editor :slight_smile: That forces it to retain the formating and content of any code you paste. It’s good stuff. Thanks for fixing your post!

1 Like

Hi @Tess_Sluijter, the “code button” is my new friend :smile:

1 Like

Thanks to all!!! i resolved the problem also on mac!!!
Thanks guys!!!:grinning::grinning::grinning:

1 Like

So what was the solution Alessandro? If you share, you may help out a future student who finds your thread :slight_smile:

1 Like