-
Notifications
You must be signed in to change notification settings - Fork 2k
Error: Error setting TTL index on collection #224
Comments
The error you show isn't related to NODE_ENV though, because as you can see mean.js is defaulting to the development environment anyway. |
Ah ok, thats not a real error then. Regarding the TTL one, I haven't touched any of the models. |
@stayko16 it seems to be an issue related to the latest version of connect-mongo/mongoose. |
Ran 'npm update' and still getting the same error... I will change the versions in package.json manually but I dont understand why it doesn't work just straight out of the box..? : / |
Is it continual? I see that sometimes when hitting the page immediately
|
Yep, every time |
I've switched to mean.io now.. |
I'm not sure what the problem is - I've confirmed that the current release is stable. @stayko16 - If you're interested in solving this issue, please try and install a fresh copy of meanjs, and try again. It's hard to replicate or debug without more information about the issue... |
@lirantal - what issue are you referring to? |
@roieki this one jdesboeufs/connect-mongo#65 |
The issue is that app.listen is called before the database gets connected, so any requests until database connection is established will fail because the session does stuff with the database. I fixed it by moving app.listen in the db connect callback. I'm not sure this will fix it 100%, but works for now:
|
This is what we ended up doing as well. Move this into master? Seems prudent. |
Yeah this is nice to have instead of what is currently in place. |
+1 |
I noticed that too and started a branch for fixing the bootup process entirely, so that the app can be used in tests, and can emit events properly to notify that it's ready but I think this will wait for integration with the 0.4 branch as the change will be quite extensive. |
Public? We ended up having to do something like this in our tests. |
Version 0.4.0 waits for the mongodb connection before starting the express application. |
This issue is still open. server.js file
App running on port 4000
/root/demo/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:246
throw message;
^
Error: Error setting TTL index on collection : sessions
at /root/demo/node_modules/connect-mongo/lib/connect-mongo.js:169:23
at /root/demo/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1354:11
at Server.Base._callHandler (/root/demo/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/base.js:453:41)
at /root/demo/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:488:18
at MongoReply.parseBody (/root/demo/node_modules/mongoose/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js:68:5)
at null.<anonymous> (/root/demo/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:446:20)
at emit (events.js:107:17)
at null.<anonymous> (/root/demo/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:207:13)
at emit (events.js:110:17)
at Socket.<anonymous> (/root/demo/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:440:22)
at Socket.emit (events.js:107:17)
at readableAddChunk (_stream_readable.js:163:16)
at Socket.Readable.push (_stream_readable.js:126:10)
at TCP.onread (net.js:538:20)
[nodemon] app crashed - waiting for file changes before starting... |
@vko-online looks like you're using an old version of MEAN.JS |
Hi there,
When running 'grunt' after generating my Mean.JS project with Yoeman and visiting my localhost I get the following error:
I have my mongo db listening for connections in the other tab. I started it using the command 'mongod'.
Thanks
The text was updated successfully, but these errors were encountered: