Wiki source code of How to connect to mongo server
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | If you have [[installed mongodb server>>doc:Main.How to Install Mongodb in Raspbian.WebHome]], then in the console, type: | ||
2 | |||
3 | {{code language="plain"}} | ||
4 | mongo | ||
5 | {{/code}} | ||
6 | |||
7 | If you see the "couldn't connect" error, it means that your mongodb server is not running: | ||
8 | |||
9 | {{code language="plain"}} | ||
10 | MongoDB shell version: 2.6.10 | ||
11 | connecting to: test | ||
12 | 2017-07-12T20:55:00.407+0800 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused | ||
13 | 2017-07-12T20:55:00.407+0800 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 | ||
14 | exception: connect failed | ||
15 | {{/code}} | ||
16 | |||
17 | and you should [[start your server>>doc:Main.How to Start Mongodb in Raspbian.WebHome]]. | ||
18 | |||
19 | If you are able to connect, press CTRL-D to quit, and you can try using python to [[store>>doc:Main.How to Use Pymongo to Store Data.WebHome]] and [[retrieve>>doc:Main.How to Use Pymongo and Search for Data.WebHome]] data from your mongodb server. |