Download
https://www.mongodb.com/try/download/community
Python Driver
https://pypi.org/project/pymongo/
$ sudo pip install -i https://pypi.douban.com/simple pymongo
ORM-like layer
https://pypi.org/project/mongoengine/
$ sudo pip install -i https://pypi.douban.com/simple mongoengine
.mongorc.js
// Re-define a new prompt. prompt = function() { if (typeof db == 'undefined') { return '(nodb)> '; } //------------------------------------------------------------- // 通常来说,提示函数中应该包含对 getLastError 的调用。这样可以 // 1) 捕获数据库错误 // 2) 在 shell 断开时自动重新连接 (比如重启了 mongod) //------------------------------------------------------------- try { db.runCommand({getLastError: 1}); } catch (e) { print(e); } return "(Current DB: " + db + ")" + "> "; }
(完)