Reputation: 229
I need to connect a Local MongoDB
to Meteor
. I did a "LeaderBoard" example in which I tried to connect to Local DB
by using the below procedure:
meteor mongo lboard.meteor.com //Deploy project name is lboard.meteor.com
MongoDB shell version: 2.4.8
connecting to: production-db-b3.meteor.io:27017/lboard_meteor_com
then i try to switch DB using the below procedure:
> use lboard_meteor_com
//This time i got the below error
switched to db lboard_meteor_com
Thu Jan 23 15:09:42.125 trying reconnect to production-db-b3.meteor.io:27017
Thu Jan 23 15:09:48.127 reconnect production-db-b3.meteor.io:27017 failed couldn
't connect to server production-db-b3.meteor.io:27017
Also, I get an error in the server console as shown below and I am new to meteor so please have a look at the below and above error and tell me what to do.
Server Console Error Log & What i am did in server is:
C:\Users\***>e:
E:\>cd ***/meteor/db
E:\***\Meteor\DB>set MONGO_URL=mongodb://localhost:27017/ddhcare_meteor_co
m
E:\**\Meteor\DB>meteor
[[[[[ E:\***\Meteor\DB ]]]]]
=> Meteor server running on: http://localhost:3000/
W20140124-13:32:29.831(5.5)? (STDERR) C:\Users\***\AppData\Local\.meteor\packag
es\mongo-livedata\31700cb194\npm\node_modules\mongodb\lib\mongodb\mongo_client.j
s:359
W20140124-13:32:29.922(5.5)? (STDERR) throw err
W20140124-13:32:29.922(5.5)? (STDERR) ^
W20140124-13:32:29.924(5.5)? (STDERR) Error: failed to connect to [localhost:270
17]
W20140124-13:32:29.925(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\server.js:540:74)
W20140124-13:32:29.925(5.5)? (STDERR) at EventEmitter.emit (events.js:106:17
)
W20140124-13:32:29.926(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\connection_pool.js:140:15)
W20140124-13:32:29.926(5.5)? (STDERR) at EventEmitter.emit (events.js:98:17)
W20140124-13:32:29.927(5.5)? (STDERR) at Socket.<anonymous> (C:\Users\Hari\A
ppData\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb
\lib\mongodb\connection\connection.js:478:10)
W20140124-13:32:29.927(5.5)? (STDERR) at Socket.EventEmitter.emit (events.js
:95:17)
W20140124-13:32:29.928(5.5)? (STDERR) at net.js:441:14
W20140124-13:32:29.928(5.5)? (STDERR) at process._tickCallback (node.js:415:
13)
=> Exited with code: 8
=> Meteor server restarted
W20140124-13:32:32.697(5.5)? (STDERR) C:\Users\Hari\AppData\Local\.meteor\packag
es\mongo-livedata\31700cb194\npm\node_modules\mongodb\lib\mongodb\mongo_client.j
s:359
W20140124-13:32:32.698(5.5)? (STDERR) throw err
W20140124-13:32:32.699(5.5)? (STDERR) ^
W20140124-13:32:32.700(5.5)? (STDERR) Error: failed to connect to [localhost:270
17]
W20140124-13:32:32.701(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\server.js:540:74)
W20140124-13:32:32.701(5.5)? (STDERR) at EventEmitter.emit (events.js:106:17
)
W20140124-13:32:32.702(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\connection_pool.js:140:15)
W20140124-13:32:32.703(5.5)? (STDERR) at EventEmitter.emit (events.js:98:17)
W20140124-13:32:32.703(5.5)? (STDERR) at Socket.<anonymous> (C:\Users\Hari\A
ppData\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb
\lib\mongodb\connection\connection.js:478:10)
W20140124-13:32:32.704(5.5)? (STDERR) at Socket.EventEmitter.emit (events.js
:95:17)
W20140124-13:32:32.705(5.5)? (STDERR) at net.js:441:14
W20140124-13:32:32.706(5.5)? (STDERR) at process._tickCallback (node.js:415:
13)
=> Exited with code: 8
=> Meteor server restarted
W20140124-13:32:35.495(5.5)? (STDERR) C:\Users\Hari\AppData\Local\.meteor\packag
es\mongo-livedata\31700cb194\npm\node_modules\mongodb\lib\mongodb\mongo_client.j
s:359
W20140124-13:32:35.497(5.5)? (STDERR) throw err
W20140124-13:32:35.498(5.5)? (STDERR) ^
W20140124-13:32:35.501(5.5)? (STDERR) Error: failed to connect to [localhost:270
17]
W20140124-13:32:35.505(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\server.js:540:74)
W20140124-13:32:35.509(5.5)? (STDERR) at EventEmitter.emit (events.js:106:17
)
W20140124-13:32:35.513(5.5)? (STDERR) at null.<anonymous> (C:\Users\Hari\App
Data\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb\l
ib\mongodb\connection\connection_pool.js:140:15)
W20140124-13:32:35.517(5.5)? (STDERR) at EventEmitter.emit (events.js:98:17)
W20140124-13:32:35.521(5.5)? (STDERR) at Socket.<anonymous> (C:\Users\Hari\A
ppData\Local\.meteor\packages\mongo-livedata\31700cb194\npm\node_modules\mongodb
\lib\mongodb\connection\connection.js:478:10)
W20140124-13:32:35.526(5.5)? (STDERR) at Socket.EventEmitter.emit (events.js
:95:17)
W20140124-13:32:35.529(5.5)? (STDERR) at net.js:441:14
W20140124-13:32:35.532(5.5)? (STDERR) at process._tickCallback (node.js:415:
13)
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.
Upvotes: 2
Views: 2412
Reputation: 65433
If you want to use a local MongoDB instance you should instead set the MONGO_URL
environment variable before starting meteor
:
export MONGO_URL=mongodb://localhost:27017/dbname
meteor
To connect to the local MongoDB instance, you should also use the mongo
shell rather than meteor mongo
:
$ mongo dbname
MongoDB shell version: 2.4.9
connecting to: test
>
Upvotes: 2