[M101JS] Access denied error while restoring mongodb database on windows

[M101JS] Access denied error while restoring mongodb database on windows
0.0 0


i am restoring mongodb database using mongorestore command on windows 32 bit os (mongodb ver 3.2).
constantly getting error access denied . I think i have set db path correctly.
please help


I assume mongod.exe is already running in the background?
(sorry for the “have you actually turned it on” advice, but you know how it is sometimes :wink: )


Can you check the file permissions of the hw_1\dump\m101\hw_1.metadata.json file?

I can’t remember the cmd command for it in Windows, but Powershell might let you look the Unix way…

For example, if I run ls -l in the ...hw1-1/dump/m101 directory I get the following:

-rw-r--r-- 1 jackson jackson   54 Jan  1  1980 hw1_1.bson
-rw-r--r-- 1 jackson jackson   92 Jan  1  1980 hw1_1.metadata.json

…which tells me I am the owner (among some other things).

Actually, now I think about it - on Windows you probably just right click the icon in the file manager to see the permissions.


I have changed file permission to Full Access . still getting same error


Try running mongorestore dump -v
That won’t fix the problem, but it should provide a little more detail in the terminal output to help us figure out what is wrong. If you get different error messages, paste them here.

Also, can you open the metadata file in a text editor?


Is there any chance you have set a username and password for your database? The docs mention possible errors if you have an unauthenticated mongorestore attempt if there is access control on the DB - but I think that is not the default setting, so if you were just following along with the course instructions and installed a fresh mongodb without making changes like that it shouldn’t be the cause. Anyway, the docs for that are here, on the off chance that’s the issue: https://docs.mongodb.com/manual/reference/program/mongorestore/#required-access


i am able to open metadata file in notepad and also bson file . also tried your command


Hmmm…not sure.

Am I right in thinking your db path is C:\data\db?

Could the issue be that you are working in a different drive, i.e. D:?

(Admittedly clutching at straws…)


It might be worth posting your screenshots on the MongoDb Uni discussion forum as a follow up to your original question there. The TAs might recgonise the error better with visuals…