Install software:

opkg update
opkg install python-openssl
opkg install distribute
easy_install pymongo

MongoDB shell:

root@debian226-8:~# mongo 192.168.0.240:27017/project  -u web_user  -p temp
MongoDB shell version: 2.4.10
connecting to: 192.168.0.240:27017/project
> db.testcollection.insert({"message":"Hello, remote user!"})
> db.testcollection.find()
{ "_id" : ObjectId("558bca5bc818c9ebe01ebdfb"), "message" : "Hello, remote user!" }
nano mongodb.py
#!/usr/bin/python
from pymongo import MongoClient
mongoserver_uri = "mongodb://web_user:[email protected]:27017/project"
conection = MongoClient(host=mongoserver_uri)
db = conection['project']
collection = db['testcollection']
print collection.find_one()
chmod 755 mongodb.py
./mongodb.py
{u'message': u'Hello, remote user!', u'_id': ObjectId('558bca5bc818c9ebe01ebdfb')}

Comments powered by CComment