Unable to find the data file in vagrant dataset folder

Im not able to get the file in vagrant /dataset folder. how can i import this from my local machine?

vagrant@m103:~$ mongoimport --drop /dataset/products.json --port 26000 -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin” --db m103 --collection products
2019-03-04T11:11:47.624+0000 Failed: open /dataset/products.json: no such file or directory
2019-03-04T11:11:47.624+0000 imported 0 documents

Commands seems to be ok
Go to the dir and run the command just giving file name(not full path)
or
run line by line

mongoimport --drop /dataset/products.json --port 26000 -u “m103-admin”
-p “m103-pass” --authenticationDatabase “admin”
–db m103 --collection products

May be i misunderstood your question
Are you not seeing the file in /dataset?
cd /dataset and ls -lrt
I can see it on my box
vagrant@m103:~/data/db$ cd /dataset
vagrant@m103:/dataset$ ls -lrt
total 90056
-rwxrwxrwx 1 vagrant vagrant 92216793 Jan 13 08:30 products.json

If you don’t see it is it available in handouts?
If yes download and copy to shared folder
There will be a folder which is mapped to your windows folder
Once file is available on vagrant folder run the import from there
Hope it is clear

I have copied the data files in my local with following folder structure

But still when i start the vagrant and check the /dataset & /shared folder the Products.json & products.part2.json files are not present. The folders are empty.

I have restarted my command prompt and tried to start vagrant with this folder structure but still it didnt work.

As per the vagrant file the mapping for these folders are

Please help me on this.

From your snapshot i see products.json is under M103
Copy it to shared or dataset dir.
Then check on vagrant box
Unless you copy the file to shared dir you cannot see it from vagrant box
When your vagrant starts you should see message like this which indicates shared dirs

==> mongod-m103: Mounting shared folders…
mongod-m103: /shared => C:/Users/ramrt/M003/m103-vagrant-env/shared
mongod-m103: /vagrant => C:/Users/ramrt/M003/m103-vagrant-env
mongod-m103: /dataset => C:/Users/ramrt/M003/m103-vagrant-env/dataset

Ramachandra,

Thank you. I have got the products.json file into /dataset folder by re-provisioning the vagrant environment. For the products.part2.json i copied the file to D://uma/Learning/MongoDB/M103/shared folder in my local machine. but still the mounting is not happening when launching vagrant.

tried the vagrant script source path as " D://uma/Learning/MongoDB/M103/shared/" & “shared/” by commenting out one of them on the vagrant file.
image

But no luck. Mounting is not happening to get the file in Vagrant.

I found the issue and fixed it. Thank you for the help.

I have the same question.
I copied the file “products.json” to shared and dataset dir.
Where can I find the vagrant box?
And I dont see the info when vagrant starts:

==> mongod-m103: Mounting shared folders…
mongod-m103: /shared => C:/Users/ramrt/M003/m103-vagrant-env/shared
mongod-m103: /vagrant => C:/Users/ramrt/M003/m103-vagrant-env
mongod-m103: /dataset => C:/Users/ramrt/M003/m103-vagrant-env/dataset

Not clear with your question “Where can I find the vagrant box?”
You would have already setup vagrant as per your class instructions
From your vagrant env directory check
vagrant status (should be up and running) assuming you have already started it with vagrant up
then
vagrant ssh
Once you are on vagrant box
check /shared dir
You should see the products.json file

– in case nothing shows up in /dataset inside the Vagrant VM, it means
– the mount is no longer mounted.
– mount it again by doing this:
vagrant@m103:/dataset$ ll
total 121588
drwxr-xr-x 1 root root 256 Apr 21 2019 ./
drwxr-xr-x 26 root root 4096 Apr 21 00:40 …/
vagrant@m103:~ cd vagrant@m103:~ sudo mount -t vboxsf dataset /dataset
vagrant@m103:~ cd /dataset vagrant@m103:/dataset ll
total 121588
drwxr-xr-x 1 root root 224 Apr 21 18:44 ./
drwxr-xr-x 26 root root 4096 Apr 21 00:40 …/
-rw-r–r-- 1 root root 92216793 Mar 5 2018 products.json
-rw-r–r-- 1 root root 11314280 Apr 21 18:44 products.json.tgz