ogian — 2012-11-05T09:42:16-05:00 — #1
Hello, I'm taking the Jumpstart Node.js course while trying to connect to MongoDB I receive the following error:
Microsoft Windows [Version 6.2.8250]
(c) 2012 Microsoft Corporation. All rights reserved.
if(databaseName.indexOf(invalidChars[i]) != -1) throw new Error("database
Error: database names cannot contain the character '.'
at validateDatabaseName (C:\\authentication\
at new Db (C:\\authentication\
at NativeConnection.doOpen (C:\\authentication\
at NativeConnection.Connection._open (C:\\authentication\
at NativeConnection.Connection.open (C:\\authentication\
at Mongoose.connect (C:\\authentication\
at connect (C:\\authentication\\lib\\db.js:16:12)
at Object.<anonymous> (C:\\authentication\\lib\\db.js:11:1)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
The offending script seems to be lib/db.js. I'm new to node.js so any help would be appreciated. Thanks.
molona — 2012-11-05T09:57:01-05:00 — #2
Can't help you just yet because I'm still waiting for my copy of the book and I'm not really familiar with it but I'm sure that some other sitepointer will be able to assist you. I hope that you didn't mind that I added code tags to your post. I think it makes the post easier to read
denk — 2012-11-05T10:46:21-05:00 — #3
I've never used Node.js, so this is just a guess, but is it possible that the problem occurs because there is a space at the beginning of the address-variable?
ogian — 2012-11-05T12:06:01-05:00 — #4
Ok, thanks. Not a problem.
ogian — 2012-11-05T12:14:21-05:00 — #5
@Denk, removing the space is the answer. Thank you. I checked to source code for the book and that has the same typo. Thanks again.
denk — 2012-11-05T13:14:52-05:00 — #6
Nice! Glad I could help
Might be an idea to e-mail the author of the book and report the typo.
ogian — 2012-11-05T13:33:08-05:00 — #7
molona — 2012-11-05T13:50:51-05:00 — #8
Now I feel ashamed of myself because I didn't even take the time to look at your code, believing that if I couldn't see it in context of the book I would not be able to help... :headbang:
Glad that it is sorte out and you found an errata
aussiejohn — 2012-11-05T15:28:24-05:00 — #9
I'm currently going through the book and didn't even pick up on this one - adding it to my list of errata
Maybe it's because I type out all the code samples rather than copying pasting, or maybe my brain just automatically ignored the space. (Or also very likely, didn't really notice it.)
ogian — 2012-11-05T16:27:27-05:00 — #10
@everyone Thanks for your quick responses.