Donny
Donny

Reputation: 959

How do you edit mongodb via SSH?

I am trying to add a value to a 'custom domain' table in mongodb connected to a Ruby forum script that I had recently installed. I'm completely new to this. How should I make this edit in SSH?

Thanks!

Upvotes: 0

Views: 427

Answers (1)

Justin Jenkins
Justin Jenkins

Reputation: 27080

Assuming by "SSH" you mean from the shell ...

MongoDB comes with a command line program called mongo which allows you to connect and preform operations on a MongoDB Database. From the command line simply run mongo ...

$ mongo
MongoDB shell version: 1.8.4
connecting to: test
> use mydb;
switched to db mydb
> db.mydb.find();
> doc = { "example" : "foo", "blah" : 1234 };
{ "example" : "foo", "blah" : 1234 }
> db.mydb.save(doc);

etc ...

There is a helpful tutorial here on how to use MongoDB from the shell: http://try.mongodb.org/

As well as more info here: http://learnmongo.com/videos/administration/mongodb-shell/

Also, here are some straight-forward docs on how to use it, it's much like using MySQL's shell program ...

http://www.mongodb.org/display/DOCS/Tutorial

http://www.mongodb.org/display/DOCS/Overview+-+The+MongoDB+Interactive+Shell

Upvotes: 3

Related Questions