Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line
1000, in _stack_context_handle_exception
raise_exc_info((type, value, traceback))
File
"/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line
256, in _nested
yield vars
File
"/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line
226, in wrapped
callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
382, in inner
self.set_result(key, result)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
315, in set_result
self.run()
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
343, in run
yielded = self.gen.throw(*exc_info)
* File
"/home/puentesarrin/projects/motor-sample/motor-sample/handlers.py", line
111, in post*
* yield motor.Op(self.db.contents.insert, content)*
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
335, in run
next = self.yield_point.get_result()
File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py", line
1365, in get_result
raise error
OperationFailure: need to login
I think that it's not about instance PyMongo Connection because, all of
queries (find/find_one) results is ok.
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line
> 1000, in _stack_context_handle_exception
> raise_exc_info((type, value, traceback))
> File
> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line
> 256, in _nested
> yield vars
> File
> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line
> 226, in wrapped
> callback(*args, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> 382, in inner
> self.set_result(key, result)
> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> 315, in set_result
> self.run()
> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> 343, in run
> yielded = self.gen.throw(*exc_info)
> * File
> "/home/puentesarrin/projects/motor-sample/motor-sample/handlers.py", line
> 111, in post*
> * yield motor.Op(self.db.contents.insert, content)*
> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> 335, in run
> next = self.yield_point.get_result()
> File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py",
> line 1365, in get_result
> raise error
> OperationFailure: need to login
> I think that it's not about instance PyMongo Connection because, all of
> queries (find/find_one) results is ok.
Replace "my_database" with the database you're using, and run this script, please. Be aware that this script drops a collection called "my_collection."
>> Traceback (most recent call last):
>> File "/usr/local/lib/python2.7/dist-packages/tornado/web.py", line >> 1000, in _stack_context_handle_exception
>> raise_exc_info((type, value, traceback))
>> File >> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line >> 256, in _nested
>> yield vars
>> File >> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line >> 226, in wrapped
>> callback(*args, **kwargs)
>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line >> 382, in inner
>> self.set_result(key, result)
>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line >> 315, in set_result
>> self.run()
>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line >> 343, in run
>> yielded = self.gen.throw(*exc_info)
>> * File >> "/home/puentesarrin/projects/motor-sample/motor-sample/handlers.py", line >> 111, in post*
>> * yield motor.Op(self.db.contents.insert, content)*
>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line >> 335, in run
>> next = self.yield_point.get_result()
>> File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py", >> line 1365, in get_result
>> raise error
>> OperationFailure: need to login
>> I think that it's not about instance PyMongo Connection because, all of >> queries (find/find_one) results is ok.
I have tried to run your snippet and I think that the problem is
Connection, because for create it, I'm using a Uri such as:
db = motor.MotorConnection('mongodb://user:p...@xxxxx.mongolab.com:
xxxxx/dbname?safe=true').open_sync().dbname
This is the traceback,
ERROR:root:Exception in callback
<tornado.stack_context._StackContextWrapper object at 0x7fc5af09bd08>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line
421, in _run_callback
callback()
File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py",
line 229, in wrapped
callback(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 382,
in inner
self.set_result(key, result)
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 315,
in set_result
self.run()
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 343,
in run
yielded = self.gen.throw(*exc_info)
File "<stdin>", line 4, in go
File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 335,
in run
next = self.yield_point.get_result()
File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py", line
1365, in get_result
raise error
OperationFailure: db assertion failure, assertion: 'unauthorized
db:my_database ns:my_database lock type:1 client:190.41.238.178',
assertionCode: 10057
Does PyMongo invoke to authenticate method when a uri have a user/password?
Or Does PyMongo ignored it, when uri have a db name?
> In that case it seems that you are, perhaps, logged in as a read-only
> user, and you're mistaken that your document was correctly inserted? Try
> this:
> import datetime
> from tornado.ioloop import IOLoop
> from tornado import gen
> import motor
> db = motor.MotorConnection().open_sync().my_database
> loop = IOLoop.instance()
> Replace "my_database" with the database you're using, and run this script,
> please. Be aware that this script drops a collection called "my_collection."
> On Thursday, September 6, 2012 3:57:53 PM UTC-4, Jorge Puente Sarrín wrote:
>> I have reviewed the DB and the document is inserted correctly, but I
>> don't understand why raise this exception.
>>> Traceback (most recent call last):
>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/web.py",
>>> line 1000, in _stack_context_handle_**exception
>>> raise_exc_info((type, value, traceback))
>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/stack_**context.py",
>>> line 256, in _nested
>>> yield vars
>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/stack_**context.py",
>>> line 226, in wrapped
>>> callback(*args, **kwargs)
>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py",
>>> line 382, in inner
>>> self.set_result(key, result)
>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py",
>>> line 315, in set_result
>>> self.run()
>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py",
>>> line 343, in run
>>> yielded = self.gen.throw(*exc_info)
>>> * File "/home/puentesarrin/projects/motor-sample/motor-sample/handlers.py",
>>> line 111, in post*
>>> * yield motor.Op(self.db.contents.insert, content)*
>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py",
>>> line 335, in run
>>> next = self.yield_point.get_result()
>>> File "/usr/local/lib/python2.7/**dist-packages/motor/__init__.**py",
>>> line 1365, in get_result
>>> raise error
>>> OperationFailure: need to login
>>> I think that it's not about instance PyMongo Connection because, all of
>>> queries (find/find_one) results is ok.
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
On Thursday, September 6, 2012 6:02:36 PM UTC-4, Jorge Puente Sarrín wrote:
> Hi Jesse,
> I have tried to run your snippet and I think that the problem is > Connection, because for create it, I'm using a Uri such as:
> db = > motor.MotorConnection('mongodb://user:p...@xxxxx.mongolab.com:xxxxx/dbname?safe=true').open_sync().dbname
> This is the traceback,
> ERROR:root:Exception in callback > <tornado.stack_context._StackContextWrapper object at 0x7fc5af09bd08>
> Traceback (most recent call last):
> File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line > 421, in _run_callback
> callback()
> File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", > line 229, in wrapped
> callback(*args, **kwargs)
> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 382, > in inner
> self.set_result(key, result)
> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 315, > in set_result
> self.run()
> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 343, > in run
> yielded = self.gen.throw(*exc_info)
> File "<stdin>", line 4, in go
> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 335, > in run
> next = self.yield_point.get_result()
> File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py", line > 1365, in get_result
> raise error
> OperationFailure: db assertion failure, assertion: 'unauthorized > db:my_database ns:my_database lock type:1 client:190.41.238.178', > assertionCode: 10057
> Does PyMongo invoke to authenticate method when a uri have a > user/password? Or Does PyMongo ignored it, when uri have a db name?
> 2012/9/6 A. Jesse Jiryu Davis <je...@10gen.com <javascript:>>
>> In that case it seems that you are, perhaps, logged in as a read-only >> user, and you're mistaken that your document was correctly inserted? Try >> this:
>> import datetime
>> from tornado.ioloop import IOLoop
>> from tornado import gen
>> import motor
>> db = motor.MotorConnection().open_sync().my_database
>> loop = IOLoop.instance()
>> Replace "my_database" with the database you're using, and run this >> script, please. Be aware that this script drops a collection called >> "my_collection."
>> On Thursday, September 6, 2012 3:57:53 PM UTC-4, Jorge Puente Sarrín >> wrote:
>>> I have reviewed the DB and the document is inserted correctly, but I >>> don't understand why raise this exception.
>>>> Traceback (most recent call last):
>>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/web.py", >>>> line 1000, in _stack_context_handle_**exception
>>>> raise_exc_info((type, value, traceback))
>>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/stack_**context.py", >>>> line 256, in _nested
>>>> yield vars
>>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/stack_**context.py", >>>> line 226, in wrapped
>>>> callback(*args, **kwargs)
>>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py", >>>> line 382, in inner
>>>> self.set_result(key, result)
>>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py", >>>> line 315, in set_result
>>>> self.run()
>>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py", >>>> line 343, in run
>>>> yielded = self.gen.throw(*exc_info)
>>>> * File "/home/puentesarrin/projects/motor-sample/motor-sample/handlers.py", >>>> line 111, in post*
>>>> * yield motor.Op(self.db.contents.insert, content)*
>>>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py", >>>> line 335, in run
>>>> next = self.yield_point.get_result()
>>>> File "/usr/local/lib/python2.7/**dist-packages/motor/__init__.**py", >>>> line 1365, in get_result
>>>> raise error
>>>> OperationFailure: need to login
>>>> I think that it's not about instance PyMongo Connection because, all of >>>> queries (find/find_one) results is ok.
>> -- >> You received this message because you are subscribed to the Google
>> Groups "mongodb-user" group.
>> To post to this group, send email to mongod...@googlegroups.com<javascript:>
>> To unsubscribe from this group, send email to
>> mongodb-user...@googlegroups.com <javascript:>
>> See also the IRC channel -- freenode.net#mongodb
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py", line
306, in insert
continue_on_error, self.__uuid_subtype), safe)
File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py", line
745, in _send_message
rv = self.__check_response_to_last_error(response)
File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py", line
681, in __check_response_to_last_error
helpers._check_command_response(error, self.disconnect)
File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line
129, in _check_command_response
raise OperationFailure(msg % response["errmsg"])
pymongo.errors.OperationFailure: need to login
Then, what's the best way for work with a MongoDB Uri and authenticate?
> I see. Does that work with a regular PyMongo Connection?:
> db = pymongo.Connection('**mongodb://user:pass@xxxxx.**mongolab.com:
> xxxxx/dbname?**safe=true').dbname
> db.my_collection.insert({}, safe=True)
> On Thursday, September 6, 2012 6:02:36 PM UTC-4, Jorge Puente Sarrín wrote:
>> Hi Jesse,
>> I have tried to run your snippet and I think that the problem is
>> Connection, because for create it, I'm using a Uri such as:
>> db = motor.MotorConnection('**mongodb://user:pass@xxxxx.**mongolab.com:
>> xxxxx/dbname?**safe=true').open_sync().dbname
>> This is the traceback,
>> ERROR:root:Exception in callback <tornado.stack_context._**StackContextWrapper
>> object at 0x7fc5af09bd08>
>> Traceback (most recent call last):
>> File "/usr/local/lib/python2.7/**dist-packages/tornado/ioloop.**py",
>> line 421, in _run_callback
>> callback()
>> File "/usr/local/lib/python2.7/**dist-packages/tornado/stack_**context.py",
>> line 229, in wrapped
>> callback(*args, **kwargs)
>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py", line
>> 382, in inner
>> self.set_result(key, result)
>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py", line
>> 315, in set_result
>> self.run()
>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py", line
>> 343, in run
>> yielded = self.gen.throw(*exc_info)
>> File "<stdin>", line 4, in go
>> File "/usr/local/lib/python2.7/**dist-packages/tornado/gen.py", line
>> 335, in run
>> next = self.yield_point.get_result()
>> File "/usr/local/lib/python2.7/**dist-packages/motor/__init__.**py",
>> line 1365, in get_result
>> raise error
>> OperationFailure: db assertion failure, assertion: 'unauthorized
>> db:my_database ns:my_database lock type:1 client:190.41.238.178',
>> assertionCode: 10057
>> Does PyMongo invoke to authenticate method when a uri have a
>> user/password? Or Does PyMongo ignored it, when uri have a db name?
>> 2012/9/6 A. Jesse Jiryu Davis <je...@10gen.com>
>>> In that case it seems that you are, perhaps, logged in as a read-only
>>> user, and you're mistaken that your document was correctly inserted? Try
>>> this:
>>> import datetime
>>> from tornado.ioloop import IOLoop
>>> from tornado import gen
>>> import motor
>>> db = motor.MotorConnection().open_**sync().my_database
>>> loop = IOLoop.instance()
>>> Replace "my_database" with the database you're using, and run this
>>> script, please. Be aware that this script drops a collection called
>>> "my_collection."
>>> On Thursday, September 6, 2012 3:57:53 PM UTC-4, Jorge Puente Sarrín
>>> wrote:
>>>> I have reviewed the DB and the document is inserted correctly, but I
>>>> don't understand why raise this exception.
>>>>> Traceback (most recent call last):
>>>>> File "/usr/local/lib/python2.7/**dist**-packages/tornado/web.py",
>>>>> line 1000, in _stack_context_handle_**exceptio**n
>>>>> raise_exc_info((type, value, traceback))
>>>>> File "/usr/local/lib/python2.7/**dist**-packages/tornado/stack_*
>>>>> *contex**t.py", line 256, in _nested
>>>>> yield vars
>>>>> File "/usr/local/lib/python2.7/**dist**-packages/tornado/stack_*
>>>>> *contex**t.py", line 226, in wrapped
>>>>> callback(*args, **kwargs)
>>>>> File "/usr/local/lib/python2.7/**dist**-packages/tornado/gen.py",
>>>>> line 382, in inner
>>>>> self.set_result(key, result)
>>>>> File "/usr/local/lib/python2.7/**dist**-packages/tornado/gen.py",
>>>>> line 315, in set_result
>>>>> self.run()
>>>>> File "/usr/local/lib/python2.7/**dist**-packages/tornado/gen.py",
>>>>> line 343, in run
>>>>> yielded = self.gen.throw(*exc_info)
>>>>> * File "/home/puentesarrin/projects/motor-sample/motor-sample/
>>>>> handlers.py", line 111, in post*
>>>>> * yield motor.Op(self.db.contents.insert, content)*
>>>>> File "/usr/local/lib/python2.7/**dist**-packages/tornado/gen.py",
>>>>> line 335, in run
>>>>> next = self.yield_point.get_result()
>>>>> File "/usr/local/lib/python2.7/**dist**-packages/motor/__init__.
>>>>> **py", line 1365, in get_result
>>>>> raise error
>>>>> OperationFailure: need to login
>>>>> I think that it's not about instance PyMongo Connection because, all
>>>>> of queries (find/find_one) results is ok.
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "mongodb-user" group.
>>> To post to this group, send email to mongod...@googlegroups.com
>>> To unsubscribe from this group, send email to
>>> mongodb-user...@**googlegroups.com
>>> See also the IRC channel -- freenode.net#mongodb
>> --
>> Atte.
>> Jorge Puente Sarrín.
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
# Calling logout then find_one here to show that we were actually authenticated.
>>> c.foo.logout()
>>> c.foo.bar.find_one()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "pymongo/collection.py", line 516, in find_one
for result in self.find(spec_or_id, *args, **kwargs).limit(-1):
File "pymongo/cursor.py", line 778, in next
if len(self.__data) or self._refresh():
File "pymongo/cursor.py", line 729, in _refresh
self.__uuid_subtype))
File "pymongo/cursor.py", line 686, in __send_message
self.__uuid_subtype)
File "pymongo/helpers.py", line 104, in _unpack_response
error_object["$err"])
pymongo.errors.OperationFailure: database error: unauthorized db:foo
ns:foo.bar lock type:0 client:127.0.0.1
On Thu, Sep 6, 2012 at 3:23 PM, Jorge Puente Sarrín
>> I see. Does that work with a regular PyMongo Connection?:
>> db =
>> pymongo.Connection('mongodb://user:p...@xxxxx.mongolab.com:xxxxx/dbname?safe=true').dbname
>> db.my_collection.insert({}, safe=True)
>> On Thursday, September 6, 2012 6:02:36 PM UTC-4, Jorge Puente Sarrín
>> wrote:
>>> Hi Jesse,
>>> I have tried to run your snippet and I think that the problem is
>>> Connection, because for create it, I'm using a Uri such as:
>>> db =
>>> motor.MotorConnection('mongodb://user:p...@xxxxx.mongolab.com:xxxxx/dbname?safe=true').open_sync().dbname
>>> This is the traceback,
>>> ERROR:root:Exception in callback
>>> <tornado.stack_context._StackContextWrapper object at 0x7fc5af09bd08>
>>> Traceback (most recent call last):
>>> File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line
>>> 421, in _run_callback
>>> callback()
>>> File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py",
>>> line 229, in wrapped
>>> callback(*args, **kwargs)
>>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 382,
>>> in inner
>>> self.set_result(key, result)
>>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 315,
>>> in set_result
>>> self.run()
>>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 343,
>>> in run
>>> yielded = self.gen.throw(*exc_info)
>>> File "<stdin>", line 4, in go
>>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line 335,
>>> in run
>>> next = self.yield_point.get_result()
>>> File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py", line
>>> 1365, in get_result
>>> raise error
>>> OperationFailure: db assertion failure, assertion: 'unauthorized
>>> db:my_database ns:my_database lock type:1 client:190.41.238.178',
>>> assertionCode: 10057
>>> Does PyMongo invoke to authenticate method when a uri have a
>>> user/password? Or Does PyMongo ignored it, when uri have a db name?
>>> 2012/9/6 A. Jesse Jiryu Davis <je...@10gen.com>
>>>> In that case it seems that you are, perhaps, logged in as a read-only
>>>> user, and you're mistaken that your document was correctly inserted? Try
>>>> this:
>>>> import datetime
>>>> from tornado.ioloop import IOLoop
>>>> from tornado import gen
>>>> import motor
>>>> db = motor.MotorConnection().open_sync().my_database
>>>> loop = IOLoop.instance()
>>>> Replace "my_database" with the database you're using, and run this
>>>> script, please. Be aware that this script drops a collection called
>>>> "my_collection."
>>>> On Thursday, September 6, 2012 3:57:53 PM UTC-4, Jorge Puente Sarrín
>>>> wrote:
>>>>> I have reviewed the DB and the document is inserted correctly, but I
>>>>> don't understand why raise this exception.
>>>>>> Traceback (most recent call last):
>>>>>> File "/usr/local/lib/python2.7/dist-packages/tornado/web.py",
>>>>>> line 1000, in _stack_context_handle_exception
>>>>>> raise_exc_info((type, value, traceback))
>>>>>> File
>>>>>> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 256,
>>>>>> in _nested
>>>>>> yield vars
>>>>>> File
>>>>>> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 226,
>>>>>> in wrapped
>>>>>> callback(*args, **kwargs)
>>>>>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py",
>>>>>> line 382, in inner
>>>>>> self.set_result(key, result)
>>>>>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py",
>>>>>> line 315, in set_result
>>>>>> self.run()
>>>>>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py",
>>>>>> line 343, in run
>>>>>> yielded = self.gen.throw(*exc_info)
>>>>>> File
>>>>>> "/home/puentesarrin/projects/motor-sample/motor-sample/handlers.py", line
>>>>>> 111, in post
>>>>>> yield motor.Op(self.db.contents.insert, content)
>>>>>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py",
>>>>>> line 335, in run
>>>>>> next = self.yield_point.get_result()
>>>>>> File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py",
>>>>>> line 1365, in get_result
>>>>>> raise error
>>>>>> OperationFailure: need to login
>>>>>> I think that it's not about instance PyMongo Connection because, all
>>>>>> of queries (find/find_one) results is ok.
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "mongodb-user" group.
>>>> To post to this group, send email to mongod...@googlegroups.com
>>>> To unsubscribe from this group, send email to
>>>> mongodb-user...@googlegroups.com
>>>> See also the IRC channel -- freenode.net#mongodb
>>> --
>>> Atte.
>>> Jorge Puente Sarrín.
>> --
>> You received this message because you are subscribed to the Google
>> Groups "mongodb-user" group.
>> To post to this group, send email to mongodb-user@googlegroups.com
>> To unsubscribe from this group, send email to
>> mongodb-user+unsubscribe@googlegroups.com
>> See also the IRC channel -- freenode.net#mongodb
> --
> Atte.
> Jorge Puente Sarrín.
> --
> You received this message because you are subscribed to the Google
> Groups "mongodb-user" group.
> To post to this group, send email to mongodb-user@googlegroups.com
> To unsubscribe from this group, send email to
> mongodb-user+unsubscribe@googlegroups.com
> See also the IRC channel -- freenode.net#mongodb
I'm sure, I'm using MongoDB version 2.2 on MongoLab, Can I send you a
private message with URI?
Traceback:
>>> c.db.bar.insert({'foo': ' bar'}, safe=True)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py", line
306, in insert
continue_on_error, self.__uuid_subtype), safe)
File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py", line
745, in _send_message
rv = self.__check_response_to_last_error(response)
File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py", line
681, in __check_response_to_last_error
helpers._check_command_response(error, self.disconnect)
File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line
129, in _check_command_response
raise OperationFailure(msg % response["errmsg"])
pymongo.errors.OperationFailure: need to login
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py", line
514, in find_one
for result in self.find(spec_or_id, *args, **kwargs).limit(-1):
File "/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py", line
749, in next
if len(self.__data) or self._refresh():
File "/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py", line
700, in _refresh
self.__uuid_subtype))
File "/usr/local/lib/python2.7/dist-packages/pymongo/cursor.py", line
657, in __send_message
self.__tz_aware)
File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line
102, in _unpack_response
error_object["$err"])
pymongo.errors.OperationFailure: database error: unauthorized db:db
ns:db.bar lock type:0 client:190.41.238.178
> # Calling logout then find_one here to show that we were actually
> authenticated.
> >>> c.foo.logout()
> >>> c.foo.bar.find_one()
> Traceback (most recent call last):
> File "<stdin>", line 1, in <module>
> File "pymongo/collection.py", line 516, in find_one
> for result in self.find(spec_or_id, *args, **kwargs).limit(-1):
> File "pymongo/cursor.py", line 778, in next
> if len(self.__data) or self._refresh():
> File "pymongo/cursor.py", line 729, in _refresh
> self.__uuid_subtype))
> File "pymongo/cursor.py", line 686, in __send_message
> self.__uuid_subtype)
> File "pymongo/helpers.py", line 104, in _unpack_response
> error_object["$err"])
> pymongo.errors.OperationFailure: database error: unauthorized db:foo
> ns:foo.bar lock type:0 client:127.0.0.1
> On Thu, Sep 6, 2012 at 3:23 PM, Jorge Puente Sarrín
> <puentesar...@gmail.com> wrote:
> > No, that's not working.
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py",
> line
> > 306, in insert
> > continue_on_error, self.__uuid_subtype), safe)
> > File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py",
> line
> > 745, in _send_message
> > rv = self.__check_response_to_last_error(response)
> > File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py",
> line
> > 681, in __check_response_to_last_error
> > helpers._check_command_response(error, self.disconnect)
> > File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line
> > 129, in _check_command_response
> > raise OperationFailure(msg % response["errmsg"])
> > pymongo.errors.OperationFailure: need to login
> > Then, what's the best way for work with a MongoDB Uri and authenticate?
> >> On Thursday, September 6, 2012 6:02:36 PM UTC-4, Jorge Puente Sarrín
> >> wrote:
> >>> Hi Jesse,
> >>> I have tried to run your snippet and I think that the problem is
> >>> Connection, because for create it, I'm using a Uri such as:
> >>> db =
> >>> motor.MotorConnection('mongodb://user:p...@xxxxx.mongolab.com:
> xxxxx/dbname?safe=true').open_sync().dbname
> >>> This is the traceback,
> >>> ERROR:root:Exception in callback
> >>> <tornado.stack_context._StackContextWrapper object at 0x7fc5af09bd08>
> >>> Traceback (most recent call last):
> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line
> >>> 421, in _run_callback
> >>> callback()
> >>> File
> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py",
> >>> line 229, in wrapped
> >>> callback(*args, **kwargs)
> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> 382,
> >>> in inner
> >>> self.set_result(key, result)
> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> 315,
> >>> in set_result
> >>> self.run()
> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> 343,
> >>> in run
> >>> yielded = self.gen.throw(*exc_info)
> >>> File "<stdin>", line 4, in go
> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> 335,
> >>> in run
> >>> next = self.yield_point.get_result()
> >>> File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py", line
> >>> 1365, in get_result
> >>> raise error
> >>> OperationFailure: db assertion failure, assertion: 'unauthorized
> >>> db:my_database ns:my_database lock type:1 client:190.41.238.178',
> >>> assertionCode: 10057
> >>> Does PyMongo invoke to authenticate method when a uri have a
> >>> user/password? Or Does PyMongo ignored it, when uri have a db name?
> >>> 2012/9/6 A. Jesse Jiryu Davis <je...@10gen.com>
> >>>> In that case it seems that you are, perhaps, logged in as a read-only
> >>>> user, and you're mistaken that your document was correctly inserted?
> Try
> >>>> this:
> >>>> import datetime
> >>>> from tornado.ioloop import IOLoop
> >>>> from tornado import gen
> >>>> import motor
> >>>> db = motor.MotorConnection().open_sync().my_database
> >>>> loop = IOLoop.instance()
> >>>> Replace "my_database" with the database you're using, and run this
> >>>> script, please. Be aware that this script drops a collection called
> >>>> "my_collection."
> >>>> On Thursday, September 6, 2012 3:57:53 PM UTC-4, Jorge Puente Sarrín
> >>>> wrote:
> >>>>> I have reviewed the DB and the document is inserted correctly, but I
> >>>>> don't understand why raise this exception.
>> # Calling logout then find_one here to show that we were actually
>> authenticated.
>> >>> c.foo.logout()
>> >>> c.foo.bar.find_one()
>> Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "pymongo/collection.py", line 516, in find_one
>> for result in self.find(spec_or_id, *args, **kwargs).limit(-1):
>> File "pymongo/cursor.py", line 778, in next
>> if len(self.__data) or self._refresh():
>> File "pymongo/cursor.py", line 729, in _refresh
>> self.__uuid_subtype))
>> File "pymongo/cursor.py", line 686, in __send_message
>> self.__uuid_subtype)
>> File "pymongo/helpers.py", line 104, in _unpack_response
>> error_object["$err"])
>> pymongo.errors.OperationFailure: database error: unauthorized db:foo
>> ns:foo.bar lock type:0 client:127.0.0.1
>> On Thu, Sep 6, 2012 at 3:23 PM, Jorge Puente Sarrín
>> <puentesar...@gmail.com> wrote:
>> > No, that's not working.
>> > Traceback (most recent call last):
>> > File "<stdin>", line 1, in <module>
>> > File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py",
>> > line
>> > 306, in insert
>> > continue_on_error, self.__uuid_subtype), safe)
>> > File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py",
>> > line
>> > 745, in _send_message
>> > rv = self.__check_response_to_last_error(response)
>> > File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py",
>> > line
>> > 681, in __check_response_to_last_error
>> > helpers._check_command_response(error, self.disconnect)
>> > File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", line
>> > 129, in _check_command_response
>> > raise OperationFailure(msg % response["errmsg"])
>> > pymongo.errors.OperationFailure: need to login
>> > Then, what's the best way for work with a MongoDB Uri and authenticate?
>> >>> ERROR:root:Exception in callback
>> >>> <tornado.stack_context._StackContextWrapper object at 0x7fc5af09bd08>
>> >>> Traceback (most recent call last):
>> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py",
>> >>> line
>> >>> 421, in _run_callback
>> >>> callback()
>> >>> File
>> >>> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py",
>> >>> line 229, in wrapped
>> >>> callback(*args, **kwargs)
>> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
>> >>> 382,
>> >>> in inner
>> >>> self.set_result(key, result)
>> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
>> >>> 315,
>> >>> in set_result
>> >>> self.run()
>> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
>> >>> 343,
>> >>> in run
>> >>> yielded = self.gen.throw(*exc_info)
>> >>> File "<stdin>", line 4, in go
>> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
>> >>> 335,
>> >>> in run
>> >>> next = self.yield_point.get_result()
>> >>> File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py",
>> >>> line
>> >>> 1365, in get_result
>> >>> raise error
>> >>> OperationFailure: db assertion failure, assertion: 'unauthorized
>> >>> db:my_database ns:my_database lock type:1 client:190.41.238.178',
>> >>> assertionCode: 10057
>> >>> Does PyMongo invoke to authenticate method when a uri have a
>> >>> user/password? Or Does PyMongo ignored it, when uri have a db name?
>> >>> 2012/9/6 A. Jesse Jiryu Davis <je...@10gen.com>
>> >>>> In that case it seems that you are, perhaps, logged in as a read-only
>> >>>> user, and you're mistaken that your document was correctly inserted?
>> >>>> Try
>> >>>> this:
>> >>>> import datetime
>> >>>> from tornado.ioloop import IOLoop
>> >>>> from tornado import gen
>> >>>> import motor
>> >>>> db = motor.MotorConnection().open_sync().my_database
>> >>>> loop = IOLoop.instance()
>> >>>> Replace "my_database" with the database you're using, and run this
>> >>>> script, please. Be aware that this script drops a collection called
>> >>>> "my_collection."
>> >>>> On Thursday, September 6, 2012 3:57:53 PM UTC-4, Jorge Puente Sarrín
>> >>>> wrote:
>> >>>>> I have reviewed the DB and the document is inserted correctly, but I
>> >>>>> don't understand why raise this exception.
> >> # Calling logout then find_one here to show that we were actually
> >> authenticated.
> >> >>> c.foo.logout()
> >> >>> c.foo.bar.find_one()
> >> Traceback (most recent call last):
> >> File "<stdin>", line 1, in <module>
> >> File "pymongo/collection.py", line 516, in find_one
> >> for result in self.find(spec_or_id, *args, **kwargs).limit(-1):
> >> File "pymongo/cursor.py", line 778, in next
> >> if len(self.__data) or self._refresh():
> >> File "pymongo/cursor.py", line 729, in _refresh
> >> self.__uuid_subtype))
> >> File "pymongo/cursor.py", line 686, in __send_message
> >> self.__uuid_subtype)
> >> File "pymongo/helpers.py", line 104, in _unpack_response
> >> error_object["$err"])
> >> pymongo.errors.OperationFailure: database error: unauthorized db:foo
> >> ns:foo.bar lock type:0 client:127.0.0.1
> >> On Thu, Sep 6, 2012 at 3:23 PM, Jorge Puente Sarrín
> >> <puentesar...@gmail.com> wrote:
> >> > No, that's not working.
> >> > Traceback (most recent call last):
> >> > File "<stdin>", line 1, in <module>
> >> > File "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py",
> >> > line
> >> > 306, in insert
> >> > continue_on_error, self.__uuid_subtype), safe)
> >> > File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py",
> >> > line
> >> > 745, in _send_message
> >> > rv = self.__check_response_to_last_error(response)
> >> > File "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py",
> >> > line
> >> > 681, in __check_response_to_last_error
> >> > helpers._check_command_response(error, self.disconnect)
> >> > File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py",
> line
> >> > 129, in _check_command_response
> >> > raise OperationFailure(msg % response["errmsg"])
> >> > pymongo.errors.OperationFailure: need to login
> >> > Then, what's the best way for work with a MongoDB Uri and
> authenticate?
> >> >>> ERROR:root:Exception in callback
> >> >>> <tornado.stack_context._StackContextWrapper object at
> 0x7fc5af09bd08>
> >> >>> Traceback (most recent call last):
> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py",
> >> >>> line
> >> >>> 421, in _run_callback
> >> >>> callback()
> >> >>> File
> >> >>> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py",
> >> >>> line 229, in wrapped
> >> >>> callback(*args, **kwargs)
> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> >> >>> 382,
> >> >>> in inner
> >> >>> self.set_result(key, result)
> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> >> >>> 315,
> >> >>> in set_result
> >> >>> self.run()
> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> >> >>> 343,
> >> >>> in run
> >> >>> yielded = self.gen.throw(*exc_info)
> >> >>> File "<stdin>", line 4, in go
> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", line
> >> >>> 335,
> >> >>> in run
> >> >>> next = self.yield_point.get_result()
> >> >>> File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py",
> >> >>> line
> >> >>> 1365, in get_result
> >> >>> raise error
> >> >>> OperationFailure: db assertion failure, assertion: 'unauthorized
> >> >>> db:my_database ns:my_database lock type:1 client:190.41.238.178',
> >> >>> assertionCode: 10057
> >> >>> Does PyMongo invoke to authenticate method when a uri have a
> >> >>> user/password? Or Does PyMongo ignored it, when uri have a db name?
> >> >>> 2012/9/6 A. Jesse Jiryu Davis <je...@10gen.com>
> >> >>>> In that case it seems that you are, perhaps, logged in as a
> read-only
> >> >>>> user, and you're mistaken that your document was correctly
> inserted?
> >> >>>> Try
> >> >>>> this:
> >> >>>> import datetime
> >> >>>> from tornado.ioloop import IOLoop
> >> >>>> from tornado import gen
> >> >>>> import motor
> >> >>>> Replace "my_database" with the database you're using, and run this
> >> >>>> script, please. Be aware that this script drops a collection called
> >> >>>> "my_collection."
> >> >>>> On Thursday, September 6, 2012 3:57:53 PM UTC-4, Jorge Puente
> Sarrín
> >> >>>> wrote:
> >> >>>>> I have reviewed the DB and the document is inserted correctly,
> but I
> >> >>>>> don't understand why raise this exception.
> >> >>>>>> Hi, I'm following the Motor examples, but my code raise a
> exception
> >> >>>>>> when insert a document using yield operator and motor Op/Task.
> >> >>>>>> Here my code:
> >> >>>>>> class ContentHandler(MotorSampleHandler):
Thanks Bernie, I hadn't thought of that. MongoDB 2.2 slightly changed how safe writes work with authentication, and Motor didn't catch up with that change until this commit last week:
>> >> # Calling logout then find_one here to show that we were actually
>> >> authenticated.
>> >> >>> c.foo.logout()
>> >> >>> c.foo.bar.find_one()
>> >> Traceback (most recent call last):
>> >> File "<stdin>", line 1, in <module>
>> >> File "pymongo/collection.py", line 516, in find_one
>> >> for result in self.find(spec_or_id, *args, **kwargs).limit(-1):
>> >> File "pymongo/cursor.py", line 778, in next
>> >> if len(self.__data) or self._refresh():
>> >> File "pymongo/cursor.py", line 729, in _refresh
>> >> self.__uuid_subtype))
>> >> File "pymongo/cursor.py", line 686, in __send_message
>> >> self.__uuid_subtype)
>> >> File "pymongo/helpers.py", line 104, in _unpack_response
>> >> error_object["$err"])
>> >> pymongo.errors.OperationFailure: database error: unauthorized db:foo
>> >> ns:foo.bar lock type:0 client:127.0.0.1
>> >> On Thu, Sep 6, 2012 at 3:23 PM, Jorge Puente Sarrín
>> >> <puente...@gmail.com <javascript:>> wrote:
>> >> > No, that's not working.
>> >> > Traceback (most recent call last):
>> >> > File "<stdin>", line 1, in <module>
>> >> > File >> "/usr/local/lib/python2.7/dist-packages/pymongo/collection.py",
>> >> > line
>> >> > 306, in insert
>> >> > continue_on_error, self.__uuid_subtype), safe)
>> >> > File >> "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py",
>> >> > line
>> >> > 745, in _send_message
>> >> > rv = self.__check_response_to_last_error(response)
>> >> > File >> "/usr/local/lib/python2.7/dist-packages/pymongo/connection.py",
>> >> > line
>> >> > 681, in __check_response_to_last_error
>> >> > helpers._check_command_response(error, self.disconnect)
>> >> > File "/usr/local/lib/python2.7/dist-packages/pymongo/helpers.py", >> line
>> >> > 129, in _check_command_response
>> >> > raise OperationFailure(msg % response["errmsg"])
>> >> > pymongo.errors.OperationFailure: need to login
>> >> > Then, what's the best way for work with a MongoDB Uri and >> authenticate?
>> >> >>> ERROR:root:Exception in callback
>> >> >>> <tornado.stack_context._StackContextWrapper object at >> 0x7fc5af09bd08>
>> >> >>> Traceback (most recent call last):
>> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py",
>> >> >>> line
>> >> >>> 421, in _run_callback
>> >> >>> callback()
>> >> >>> File
>> >> >>> "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py",
>> >> >>> line 229, in wrapped
>> >> >>> callback(*args, **kwargs)
>> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", >> line
>> >> >>> 382,
>> >> >>> in inner
>> >> >>> self.set_result(key, result)
>> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", >> line
>> >> >>> 315,
>> >> >>> in set_result
>> >> >>> self.run()
>> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", >> line
>> >> >>> 343,
>> >> >>> in run
>> >> >>> yielded = self.gen.throw(*exc_info)
>> >> >>> File "<stdin>", line 4, in go
>> >> >>> File "/usr/local/lib/python2.7/dist-packages/tornado/gen.py", >> line
>> >> >>> 335,
>> >> >>> in run
>> >> >>> next = self.yield_point.get_result()
>> >> >>> File "/usr/local/lib/python2.7/dist-packages/motor/__init__.py",
>> >> >>> line
>> >> >>> 1365, in get_result
>> >> >>> raise error
>> >> >>> OperationFailure: db assertion failure, assertion: 'unauthorized
>> >> >>> db:my_database ns:my_database lock type:1 client:190.41.238.178',
>> >> >>> assertionCode: 10057
>> >> >>> Does PyMongo invoke to authenticate method when a uri have a
>> >> >>> user/password? Or Does PyMongo ignored it, when uri have a db name?
>> >> >>> 2012/9/6 A. Jesse Jiryu Davis <je...@10gen.com>
>> >> >>>> In that case it seems that you are, perhaps, logged in as a >> read-only
>> >> >>>> user, and you're mistaken that your document was correctly >> inserted?
>> >> >>>> Try
>> >> >>>> this:
>> >> >>>> import datetime
>> >> >>>> from tornado.ioloop import IOLoop
>> >> >>>> from tornado import gen
>> >> >>>> import motor
>> >> >>>> Replace "my_database" with the database you're using, and run this
>> >> >>>> script, please. Be aware that this script drops a collection >> called
>> >> >>>> "my_collection."
>> >> >>>> On Thursday, September 6, 2012 3:57:53 PM UTC-4, Jorge Puente >> Sarrín
>> >> >>>> wrote:
>> >> >>>>> I have reviewed the DB and the document is inserted correctly, >> but I
>> >> >>>>> don't understand