mrsarm / mongotail

Command line tool to log all MongoDB queries in a "tail"able way
https://pypi.org/project/mongotail/
GNU General Public License v3.0
192 stars 17 forks source link

Unknown command operation, unknown registry? #6

Closed kengruven closed 9 years ago

kengruven commented 9 years ago

When I run Mongotail (which is very helpful, BTW!), sometimes I get lines like this:

Mongotail EXCEPTION - Unknown command operation
Dump: {"ns": "dbname.$cmd", "command": {"createIndexes": "collectionname", "indexes": [{"key": {"fieldname": 1}, "unique": true, "sparse": false, "background": false, "name": "fieldname_1"}]}, "ts": ISODate("2015-09-21T20:47:21.719Z"), "op": "command"}
Mongotail EXCEPTION - Unknown registry
Dump: {"ns": "dbname.$cmd", "command": {"createIndexes": "collectionname", "indexes": [{"key": {"fieldname": 1}, "unique": true, "sparse": false, "background": false, "name": "fieldname_1"}]}, "ts": ISODate("2015-09-21T20:47:21.719Z"), "op": "command"}

I think they're from my framework ensuring that the proper indexes exist in my Mongo database.

Looking at issue #5, I suspect this might be as simple as adding a new entry for operation "createIndexes" in out.py, but I haven't tried it yet.

mrsarm commented 9 years ago

I tried to reproduce your error but without success. I had created indexes manually with http://docs.mongodb.org/master/reference/command/createIndexes/ and then executed Mongotail, but the tool ignore this kind of command operations.

What is the framework are you using? And which version?

kengruven commented 9 years ago

I'm using mongoengine 0.10.0. I'm not calling createIndexes in my code anywhere, so I assume that's what's doing it.

I'm using Mongo 2.6.11, if that makes any difference.

mrsarm commented 9 years ago

I tried again with a little test with mongoengine == 0.10.0, but again without errors. Could you test your application with mongotail -f option, and try to figure out after what operation this is happening?

Are you using the latest mongotail 1.0.1 version right?

ChrisMcKee commented 9 years ago

@mrsarm I get the same error for some queries.

Mongotail EXCEPTION - Unknown command operation
Dump: {"ns": "readstore.$cmd", "command": {"createIndexes": "AReadModel", "indexes": [{"unique": false, "ns": "readstore.AReadModel", "name": "XId_1", "key": {"XId": 1}}]}, "ts": ISODate("2015-09-30T09:12:07.691Z"), "op": "command"}
Mongotail EXCEPTION - Unknown registry
Dump: {"ns": "readstore.$cmd", "command": {"createIndexes": "AReadModel", "indexes": [{"unique": false, "ns": "readstore.AReadModel", "name": "XId_1", "key": {"XId": 1}}]}, "ts": ISODate("2015-09-30T09:12:07.691Z"), "op": "command"}

And it fails to log the query that followed.

This is using the C# 1.10X driver from mongodb.

Also, is there any way of getting the other parts to output with the query (limit / fields) ?

kengruven commented 9 years ago

I had been using mongotail 1.0.0. I've upgraded to 1.0.1, and I still see the same messages.

I always use mongotail -f, but I don't know exactly what's causing this to happen. I assume it's something in the mongoengine.connect(...) call. I'll see if I can narrow it down a bit.

ChrisMcKee commented 9 years ago

Yeah its somewhere between the connection and index creation need to strip down the code im using to get to the bit causing it (too much wiring :p )

mrsarm commented 9 years ago

@kengruven, @ChrisMcKee, please try the new patch pushed. I couldn't reproduce the error, but I think that this patch will solve your problems.

ChrisMcKee commented 9 years ago

@mrsarm good news IT'S FIXED. Thanks!

kengruven commented 9 years ago

Yes, I tried 0e3dc55 just now and I'm no longer seeing any such lines in the output, even when I do something that should cause an index change. Thanks!

mrsarm commented 9 years ago

Thanks both of you! I will publish now this in the new version 1.1.0 at PyPI.