2
votes

Notes before: this is updated, and there is a question with the name 'error: database names cannot contain the character '.' but this is with a space or a null character, not a dot! I am not sure if that could be a major difference, but apart from that question, the answer supposed there did not help me further. Also, I use Windows 7 (32 bits (not the best thing for mongodb, I know) and I made the description a bit more detailed).

To the point: I wanted to start meteor again for the first time after a couple of days (everything worked fine before) and suddenly this error appeared:

W20150803-18:44:47.168(2)? (STDERR) C:\Users\Laptop\AppData\Local\.meteor\packag
es\meteor-tool\1.1.3\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fib
ers\future.js:245
W20150803-18:44:47.168(2)? (STDERR)
throw(ex);
W20150803-18:44:47.168(2)? (STDERR)
      ^
W20150803-18:44:47.168(2)? (STDERR) Error: database names cannot contain the cha
racter ' '
W20150803-18:44:47.169(2)? (STDERR)     at validateDatabaseName (C:\Users\Laptop
\AppData\Local\.meteor\packages\mongo\1.1.0\npm\node_modules\mongodb\lib\mongodb
\db.js:235:59)
W20150803-18:44:47.169(2)? (STDERR)     at new Db (C:\Users\Laptop\AppData\Local
\.meteor\packages\mongo\1.1.0\npm\node_modules\mongodb\lib\mongodb\db.js:97:3)
W20150803-18:44:47.169(2)? (STDERR)     at connectFunction (C:\Users\Laptop\AppD
ata\Local\.meteor\packages\mongo\1.1.0\npm\node_modules\mongodb\lib\mongodb\mong
o_client.js:275:29)
W20150803-18:44:47.169(2)? (STDERR)     at Function.MongoClient.connect (C:\User
s\Laptop\AppData\Local\.meteor\packages\mongo\1.1.0\npm\node_modules\mongodb\lib
\mongodb\mongo_client.js:345:5)
W20150803-18:44:47.170(2)? (STDERR)     at Function.Db.connect (C:\Users\Laptop\
AppData\Local\.meteor\packages\mongo\1.1.0\npm\node_modules\mongodb\lib\mongodb\
db.js:2094:23)
W20150803-18:44:47.170(2)? (STDERR)     at new MongoConnection (packages/mongo/m
ongo_driver.js:173:1)
W20150803-18:44:47.170(2)? (STDERR)     at new MongoInternals.RemoteCollectionDr
iver (packages/mongo/remote_collection_driver.js:4:1)...
W20150803-18:44:47.171(2)? (STDERR)     at Object.<anonymous> (packages/mongo/re
mote_collection_driver.js:38:1)
W20150803-18:44:47.171(2)? (STDERR)     at Object.defaultRemoteCollectionDriver
(packages/underscore/underscore.js:750:1)
W20150803-18:44:47.171(2)? (STDERR)     at new Mongo.Collection (packages/mongo/
collection.js:98:1)

A database name being empty while I haven't created any database in the meantime left me in utter darkness since then. I thought it had to do with one specific project I tried to run (that project already had a load of issues by setting it up, but in the end it worked anyway), but I hadn't changed anything in there, neither did I change any other project. What made me more confused, is that I got this same error on every single other project I have tried to start.

After a while, I rebooted, and the projects started again, but the actual project where all of this began, failed again, this time showing an old known error:

Unexpected mongo exit code 14. Restarting.
Unexpected mongo exit code 100. Restarting.
Unexpected mongo exit code 100. Restarting.
Can't start Mongo server.
MongoDB had an unspecified uncaught exception.
This can be caused by MongoDB being unable to write to a local database.
Check that you have permissions to write to .meteor/local. MongoDB does
not support filesystems like NFS that do not allow file locking.

The original solution to that, was running this in CMD:

"c:\mongodb\bin\mongod.exe" --port 27017 --dbpath "C:\Users\Laptop\TheDatabaseFolder\rs2" --replSet rs2 --smallfiles --setParameter failIndexKeyTooLong=false //note: this had to be done due to 32 bit issue

rs.initiate() 

This still gave the same 'cannot write' error although the CMD showed that writing was permitted. Finally I did this:

set MONGO_URL=mongodb://localhost:27017/meteor 

Then I fired meteor with a specific config file (due to packages failing to load)

meteor --settings ../config/development/settings.json.dist

And there was the main problem with the database name containing a space or null character again.

In general: what is the most efficient way to get rid of this problem? Why could this have been suddenly sneaking into every project to make them fail? And, where is this 'packages/mongo/collection.js' (in general 'packages/mongo' as such) located anyway? I cannot find it at all...

Thanks in advance.

1

1 Answers

1
votes

I would get this error every time I restarted my computer and then tried to make any sort of request. It appears to be something with the favicon.ico file. I'm just using local host to test out API calls so I obviously did not have this file. I'm pretty sure my requests were reading this as a database name, which would have the illegal '.' character. I finally added:

app.get('/favicon.ico', function(req, res) {
    res.sendStatus(204);
});

And now everything seems to work again. There is a 204 response for the favicon.ico request every time I put through a request, but it works.