1
連接我用這對插入:蒙戈連接失敗時,我已經通過pymongo
import pymongo
import sys
def main():
connection = pymongo.Connection("mongodb://localhost", safe=True)
db = connection.m101
people = db.people
person ={'name': 'Barack Obama', 'role':'President',
'address':{'address1': 'The White House',
'street': '1600 Pensylvania Avenue',
'state':'DC',
'city':'Washington'},
'interests':['government', 'basketball', 'the middle east']
}
people.insert(person)
,當我嘗試用寫作mongo
命令它說
Could not connect to server 127.0.0.1:27017 src/mongo
shell mongo.js:91
exception: connection failed
可以做些什麼?我正在關注他們的教程!
是MongoDB的實際運行,並監聽本地主機? –
請參閱此處以獲取更多信息http://stackoverflow.com/questions/14499277/cannot-connect-to-mongodb#comment20209093_14499277 – br3w5