I am new to Mongo and Meteor.
I have installed Meteor on Mac OSX 10.8, and I have created a new Meteor app using a collection called 'Fillup'.
I am going through some tutorials about Mongo, and I am trying to learn the shell commands, but none of them are working.
I want to use Mongo command line to view and manipulate the collection I have going in my Meteor app.
I installed Mongo seperately after Meteor, and I think Meteor might me using a different 'copy' of Mongo, because now when I try 'mongo' I get :
$ mongo
MongoDB shell version: 2.4.5
connecting to: test
Sun Jul 28 14:25:33.055 JavaScript execution failed: Error: couldn't connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112
exception: connect failed
Whether Meteor is running or not, and Meteor works fine.
Meteor is using different binaries of Mongo to keep the compatible version.
If you want to test your Mongo shell commands or just play with it on the same version as Meteor, create a Meteor app and keep it running:
meteor create testapp
cd testapp
meteor
And in different shell (or tab) run
meteor mongo
The reason why it didn’t work in your case: you didn’t start the MongoDB server command mongod. But when you run your Mongo app locally, it will run mongod with the correct set of flags and separate database file.
Try running mongod first and then mongo.
To start MongoDB using all defaults, issue the following command at the system shell:
mongod
This is for vanilla MongoDB though, you might be using a Meteor-specific flavor like someone else mentioned.
http://docs.mongodb.org/manual/tutorial/manage-mongodb-processes/
Related
I installed mongodb on mac using brew and official guides. mongodb seemed to installed correctly. when i go to terminal and type sudo mongod it produces bunch of logs and final that db is listening on port 27017 i can open tab in browser localhost:27017 which doesnt seem to do anything but at least i know it works. mongodb is taking over terminal and i can type commands but i dont get any response for any command. i tried:
show dbs
use testdb
and so on. doesnt matter what i type it never returns any response. what did i do wrong?
OSX 10.9.5
db version 3.2.8
The mongod command you entered refers to the mongo daemon process which runs in the background.
Try typing mongo in your terminal instead of mongod and you should see the following input with the '>' prompt:
MongoDB shell version x.x.x
connecting to: xxx
Then you can type show dbs and see your databases.
I am trying to figure out development with django and postgresql while using windows as the host OS. I followed 2 tutorials and both of them want me to run commands using docker-compose run, but it doesn't work on windows. It says:
> docker-compose.exe run web django-admin.py startproject rolesweb .
←[31mERROR←[0m: Interactive mode is not yet supported on Windows.
Please pass the -d flag when using `docker-compose run`.
Is there an alternative to this command? What should I do to be able to follow the tutorials further?
The tutorials:
https://docs.docker.com/compose/django/
https://realpython.com/blog/python/django-development-with-docker-compose-and-machine/
An alternative is to run docker-compose through a container where docker-compose is installed. That is what I initially recommended. In that context, the -d option would be supported.
docker-compose itself depends on nodejs/node-gyp which does not work well on Windows.
I'm on OS/X Macbook and recently installed mongodb to try my hands on it. I installed it using shell commands. I scrapped some data and passed into it and when I tried looking for it, the connection was getting failed. On googling the root cause, I found there was some mongodb.lock file, and I removed it using bash command.
Now, I'm trying to restart using the following command
sudo service mongodb restart
However, it is saying
sudo: service: command not found
in addition, if I start mongodb by navigating to folder and then using the command ./bin/mongo, it displays the following error:
MongoDB shell version: 3.0.7
connecting to: test
2015-11-08T14:47:56.965+0800 W NETWORK Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2015-11-08T14:47:56.967+0800 E QUERY Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed
at connect (src/mongo/shell/mongo.js:179:14)
at (connect):1:6 at src/mongo/shell/mongo.js:179
exception: connect failed
can someone please help how to resolve it.
AFAIK there is no service command on Mac. And ./bin/mongo runs a shell client, you need to run .bin/mongod with relevant --dbpath argument. You can find more info here
Like Yuri wrote, there is no service command on OS X. You need to manage MongoDB yourself by starting it with the mongod command.
An Alternative is to install MongoDB via MacPorts.
After you successfully installed MacPorts, you simply install MongoDB with
sudo port install mongodb
You can start MongoDB quite easily then with
sudo port load mongodb
and stop it with
sudo port unload mongodb
mongo is the client. You haven't had the server running, so it is only natural that you can not connect to the server.
Some side note: OS X is not very close to Linux. OS X is based on a flavor of BSD-UNIX, which in turn is based on Research UNIX. Linux started as a free implementation of Minix, based on GNU utilities. So assuming that you'd have Linux tools available on the OS X command line is pretty dangerous. Often, the tools (if present) even share the name, but are different implementations of the same functionality with some differences in usage. So, get it in your head: With OS X, you do not use the hipster version of Linux – you use BSD on steroids. Hence, I will remove the "linux" tag and add the OS X tag.
Running OSX 10.9.2, I just ran brew upgrade mongo which upgraded my mongo to version 2.6
As per the instructions I've run
launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mongodb.plist
But now when I run mongo it says
MongoDB shell version: 2.6.0
connecting to: test
2014-05-05T10:07:22.769+1000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:61 Connection refused
2014-05-05T10:07:22.770+1000 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
Things I've tried:
I've seen this covered on other SX questions and people have suggested creating a /data/db folder but this wasn't needed previously and I don't want to lose the data from my old instance of mongo. Regardless, I tried it, and chowned it to allow read/write from my user account, but that made no difference. (FYI my data lives in /usr/local/var/mongodb/ which is typical I believe for OSX.)
A lot of the other questions also assume Linux rather than Mac, or they wade off into PHP land which is not relevant to me.
I've also tried rebooting my Mac.
I fixed it by forcing home-brew to restart it.
brew services restart mongodb
and voila
$ mongo
MongoDB shell version: 2.6.0
connecting to: test
>
now works a treat.
If I had Apple's Lion (or higher) OS, I would simply:
-follow heroku tutorial: https://devcenter.heroku.com/articles/heroku-postgresql#local-setup
-install postgres.app on my OS
-run "heroku pg:psql" (the above step is required for this command to work)
-and then just run the necessary SQL commands
The problem is that I am running Snow Leopard (upgrading is not an option at the moment for a number of reasons).
postgres.app (see: postgresapp.com) only works on Lion and Mountain Lion.
I haven't been able to find an alternative to postgres.app. Any ideas?
I did see this list of potential alternatives (http://www.postgresql.org/download/macosx/) but I am unsure if they'll work.
Any guidance?
(if it means anything, I'm using node.js.)
Thanks :)
When you run heroku pg:psql you're connecting a postgres client to a remote Postgres database, backing your application on Heroku. This will let you inspect/modify the remote, production database running in your Heroku application.
If you're running a node.js application and need to deply schema changes on your Heroku app, you can run heroku run node schema.js to deploy your most recent schema.
I just found the answer at: http://dailyjs.com/2011/09/26/heroku/
You seemingly just create a schema.js file which connects to the database as usual and includes all the necessary commands to create the desired tables and then just run that file using:
"heroku run node schema.js"
(Sorry. I'm very new to this stuff)