I'm a little confused by the document when I tried to connect to the Mongodb.And I find it's different from mysql.I want to create a new database named "mydb" and insert some posts into it.The follows is what I'm trying.
from pymongo.connection import Connection
import datetime
host = 'localhost'
port = 27017
user = 'ucenter'
passwd = '123'
connection = Connection(host,port)
db = connection['mydb']
post = {'author':'mike',
'text':'my first blog post!',
'tags':['mongodb','python','pymongo'],
'date':datetime.datetime.utcnow()}
posts = db.posts
posts.insert(post)
#print str(db.collection_names())
And I got an error as pymongo.errors.OperationFailure: database error: unauthorized.How can I do the authorizing part?Thanks.