syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

Question:
Is meteor mongo broken?

I tried using the 'meteor mongo' shell command on my Ubuntu host and found that it is broken.

To reproduce the bug I posted a screen dump to the Meteor Forum:

https://forums.meteor.com


dan@nia111:~ $ which meteor
/home/dan/.meteor/meteor
dan@nia111:~ $ 
dan@nia111:~ $ 
dan@nia111:~ $ meteor --version
Meteor 1.2.1
dan@nia111:~ $ 
dan@nia111:~ $ meteor create met12
Created a new Meteor app in 'met12'.

To run your new app:
  cd met12
  meteor

If you are new to Meteor, try some of the learning resources here:
  https://www.meteor.com/learn

dan@nia111:~ $ 
dan@nia111:~ $ cd met12
dan@nia111:~/met12 $ 
dan@nia111:~/met12 $ meteor
[[[[[ ~/met12 ]]]]]

=> Started proxy.
=> Started MongoDB.
=> Started your app.

=> App running at: http://localhost:3000/
Other shell:

dan@nia111:~/met12 $ 
dan@nia111:~/met12 $ 
dan@nia111:~/met12 $ ps -ef|grep mongo
dan       7876  7812  0 04:18 pts/38   00:00:00 grep mongo
dan@nia111:~/met12 $ ps -ef | grep meteor
dan       7724  7593 15 04:16 pts/37   00:00:18 /home/dan/.meteor/packages/meteor-tool/.1.1.10.ki0
dan       7747  7724  0 04:16 pts/37   00:00:00 /home/dan/.meteor/packages/meteor-tool/.1.1.10.ki0
dan       7799  7724  0 04:16 pts/37   00:00:00 /home/dan/.meteor/packages/meteor-tool/.1.1.10.ki0
dan       7878  7812  0 04:18 pts/38   00:00:00 grep meteor
dan@nia111:~/met12 $ 
dan@nia111:~/met12 $ meteor mongo
mongo: Meteor isn't running a local MongoDB server.

This command only works while Meteor is running your application locally. Start
your application first with 'meteor' and then run this command in a new
terminal. This error will also occur if you asked Meteor to use a different
MongoDB server with $MONGO_URL when you ran your application.

If you're trying to connect to the database of an app you deployed with
'meteor deploy', specify your site's name as an argument to this command.
dan@nia111:~/met12 $ 
dan@nia111:~/met12 $ env|grep MONGO
dan@nia111:~/met12 $ 
dan@nia111:~/met12 $ 
The work around is to find the mongo command under .meteor and then use it like this:

dan@nia111:~ $ cd bin
dan@nia111:~/bin $ find ~/.meteor -name mongo -type f -print
/home/dan/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/mongodb/bin/mongo
dan@nia111:~/bin $ ln -s /home/dan/.meteor/packages/meteor-tool/.1.1.10.ki0ccv++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/mongodb/bin/mongo .
dan@nia111:~/bin $ mongo
The program 'mongo' is currently not installed. You can install it by typing:
sudo apt-get install mongodb-clients
dan@nia111:~/bin $ ./mongo
MongoDB shell version: 2.6.7
connecting to: test
2015-12-04T05:06:47.423+0000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused
2015-12-04T05:06:47.424+0000 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed
dan@nia111:~/bin $ 
dan@nia111:~/bin $ 
dan@nia111:~/bin $ ./mongo --port=3001
MongoDB shell version: 2.6.7
connecting to: 127.0.0.1:3001/test
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
	http://docs.mongodb.org/
Questions? Try the support group
	http://groups.google.com/group/mongodb-user
meteor:PRIMARY> 
meteor:PRIMARY> show dbs
admin  (empty)
local  0.063GB
test   0.031GB
meteor:PRIMARY> 
meteor:PRIMARY> 
meteor:PRIMARY> use meteor
switched to db meteor
meteor:PRIMARY> 
meteor:PRIMARY> db.tasks.insert({ text: "Hello world!", createdAt: new Date() });
WriteResult({ "nInserted" : 1 })
meteor:PRIMARY> 
meteor:PRIMARY> 



syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me