Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MongoServerError: Invalid namespace specified 'local_library/.genres' #34388

Closed
SillyBorbo opened this issue Jun 24, 2024 · 5 comments
Closed
Assignees
Labels
Content:Learn:Express Learning area Express docs

Comments

@SillyBorbo
Copy link
Contributor

MDN URL

https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/mongoose

What specific section or headline is this issue about?

Testing - Create Some Items

What information was incorrect, unhelpful, or incomplete?

Followed the tutorial exactly. When trying to run node populatedb <mongodb url>, I get the error "MongoServerError: Invalid namespace specified 'local_library/.genres" (code: 73). I'm very new to this and don't know what the problem is. I copy-pasted all of the code to ensure that I didn't mistype anything. And yes, I followed the steps to set up mongodb cloud.

What did you expect to see?

The script should complete without error.

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

No response

MDN metadata

Page report details
@SillyBorbo SillyBorbo added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jun 24, 2024
@github-actions github-actions bot added the Content:Learn:Express Learning area Express docs label Jun 24, 2024
@Josh-Cena Josh-Cena removed the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jun 24, 2024
@hamishwillee
Copy link
Collaborator

hamishwillee commented Jun 24, 2024

Did you do the challenge? https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/mongoose#genre_model_-_challenge!

The error seems to indicate that mongodb doesn't know about genres so it is possibly you didn't do that bit?

The populate.db assumes you did (I might need to make that clear - this is something you have to do)

If you did, the next step is to check that your models code matches the worked project here: https://github.com/mdn/express-locallibrary-tutorial/tree/main/models

@SillyBorbo
Copy link
Contributor Author

Yes, challenge was done. I edited populatedb.js to skip genres and it has the same error with authors. Maybe this is a networking issue with mongodb? I am doing this on my work computer. I also know next to nothing about networking.

@SillyBorbo
Copy link
Contributor Author

I finally found the problem. My mongodb url looked like:
...mongodb.net/local_library/?retryWrites=true...
When I removed the "/" just before the "?"
...mongodb.net/local_library?retryWrites=true...
It worked. I guess it was just my mistyping.

@SillyBorbo
Copy link
Contributor Author

Now that I notice it, the error message
Invalid namespace specified 'local_library/.genres'
actually shows the problem. I expect that the "/" after local_library wouldn't be there if genres truly didn't exist and I had typed the correct url.

@hamishwillee
Copy link
Collaborator

Glad you worked it out. Something for me to remember if I see the URL again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:Learn:Express Learning area Express docs
Projects
None yet
Development

No branches or pull requests

3 participants