New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error message for "meteor mongo" when your apps is running with $MONGO_URL is misleading #1256

Closed
betacar opened this Issue Jul 29, 2013 · 6 comments

Comments

Projects
None yet
4 participants
@betacar

betacar commented Jul 29, 2013

Since I haven't received a answer about this in the mailing list and StackOverflow, I'm gonna posted here to see if anyone can solve this.

I'm trying to connect Meteor to an existing MongoDB. I can't duplicate the database or change its name, because is used by other app.

I know I have to set a MONGO_URL environment var to connect with it. However, after I set it, Meteor is not connecting to the specified MongoDB database. I tried doing a .find() but it does not return any docs. An .insert() from the web console shows the info in the page, but it doesn't get inserted in the database.

After running meteor with meteor run, I opened a new console window within project directory to run a meteor mongo console. However, after running meteor mongo I received the following:

$ meteor mongo
mongo: Meteor isn't running.

This command only works while Meteor is running your application
locally. Start your application first.

Here are the codes:

$ echo $MONGO_URL
mongodb://localhost:27017/autana_dev

./lib/models.js

Posts = new Meteor.Collection('posts');

./server/app.js

Meteor.publish('posts', function() {
  return Posts.find();
});

./client/app.js

Meteor.subscribe('posts');

Template.main.posts = function() {
  return Posts.find();
};

Any idea? Anyone? My Meteor version release is 0.6.4.1, and the MongoDB version is 2.4.1.

@glasser

This comment has been minimized.

Member

glasser commented Aug 1, 2013

Good point, the "meteor mongo" command only knows how to connect to two kinds of mongos:

  • with no arguments, to a managed-by-meteor locally-running mongodb (but not to a specified-by-MONGO_URL one)
  • with an argument, to a mongo managed by "meteor deploy"

Changed the issue title to reflect this. "meteor mongo" really isn't too fancy though, you should just be able to run "mongo $MONGO_URL" if you have your own mongodb.

@glasser

This comment has been minimized.

Member

glasser commented Aug 19, 2013

A possible implementation here would be, instead of meteor mongo re-calculating the MONGO_URL, for it to connect to the running app and get it from there. eg, the meteor run proxy server could serve the URL on a magic path string.

@foobarbecue

This comment has been minimized.

Contributor

foobarbecue commented Apr 29, 2014

So... in the meantime, how do we use "meteor mongo" with "meteor run"? Is there a workaround?

@dcsan

This comment has been minimized.

dcsan commented Apr 29, 2014

why do you need to use meteor mongo? this is just a wrapper for running the mongodb command line client. why not use the normal mongo shell as mongo $MONGO_URL

@foobarbecue

This comment has been minimized.

Contributor

foobarbecue commented Apr 29, 2014

Yeah, that's what I ended up doing -- just found the port number in ./meteor/db/METEOR-PORT , installed a mongo client from ubuntu repository, and connected. This is clearly a bug, though -- the error message says you don't have meteor running, which is incorrect. http://stackoverflow.com/questions/17886152/meteor-does-not-connect-to-mongodb/23357958#answer-23357958

@glasser

This comment has been minimized.

Member

glasser commented May 1, 2014

Um, .meteor/local/db/METEOR-PORT is only relevant if meteor is running mongod, ie if you didn't specify MONGO_URL...

@glasser glasser closed this in 5137250 May 1, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment