Unrecognized pipeline stage name: '$changeStream'

463 views
Skip to first unread message

Marius Kriegerowski

unread,
Jul 12, 2019, 8:24:30 PM7/12/19
to mongodb-user
Hey,

Working with:
 - debian buster
 - pymongo version 3.8.0
 - mongo --version
MongoDB shell version v3.4.18
git version: 4410706bef6463369ea2f42399e9843903b31923
OpenSSL version: OpenSSL 1.1.1c  28 May 2019
allocator: tcmalloc
modules: none
build environment:
    distarch: x86_64
    target_arch: x86_64

I'm using pymongo and motor for async pymongo access. I copy-pasted the websocket example mostly cause I couldn't get the `watch` method to work. Seems like the example throws the same exception as did my codes:
[E 190712 13:59:03 ioloop:763] Exception in callback
functools
.partial(<bound method IOLoop._discard_future_result of
<tornado.platform.asyncio.AsyncIOMainLoop object at
0x7f284ca71c88>>, <Task finished coro=<watch() done, defined
 at test_tornado
.py:89> exception=OperationFailure("Unrecognized
pipeline stage name: '$changeStream'"
)>)
   
Traceback (most recent call last):
     
File "/home/marius/.local/lib/python3.7/site-packages/tornado/ioloop.py", line 743, in _run_callback
        ret
= callback()
     
File "/home/marius/.local/lib/python3.7/site-packages/tornado/ioloop.py", line 767, in _discard_future_result
        future
.result()
     
File "test_tornado.py", line 93, in watch
        async
for change in change_stream:
     
File "/usr/lib/python3.7/concurrent/futures/thread.py", line 57, in run
        result
= self.fn(*self.args, **self.kwargs)
     
File "/home/marius/.local/lib/python3.7/site-packages/motor/core.py", line 1412, in _next
       
self.delegate = self._target.delegate.watch(**self._kwargs)
     
File "/home/marius/.local/lib/python3.7/site-packages/pymongo/collection.py", line 2536, in watch
        batch_size
, collation, start_at_operation_time, session
     
File "/home/marius/.local/lib/python3.7/site-packages/pymongo/change_stream.py", line 85, in __init__
       
self._cursor = self._create_cursor()
     
File "/home/marius/.local/lib/python3.7/site-packages/pymongo/change_stream.py", line 166, in _create_cursor
        explicit_session
=self._session is not None
     
File "/home/marius/.local/lib/python3.7/site-packages/pymongo/change_stream.py", line 137, in _run_aggregation_cmd
        client
=self._database.client)
     
File "/home/marius/.local/lib/python3.7/site-packages/pymongo/pool.py", line 584, in command
        user_fields
=user_fields)
     
File "/home/marius/.local/lib/python3.7/site-packages/pymongo/network.py", line 158, in command
        parse_write_concern_error
=parse_write_concern_error)
     
File "/home/marius/.local/lib/python3.7/site-packages/pymongo/helpers.py", line 155, in _check_command_response
       
raise OperationFailure(msg % errmsg, code, response)
    pymongo
.errors.OperationFailure: Unrecognized pipeline stage name: '$changeStream'
Is it a compatibility issue of motor and pymongo?
Thanks!
Marius

Stephen Steneker

unread,
Jul 12, 2019, 8:50:43 PM7/12/19
to mongodb-user
On Saturday, 13 July 2019 10:24:30 UTC+10, Marius Kriegerowski wrote:
 - mongo --version
MongoDB shell version v3.4.18

Hi Marius,

What is your MongoDB server version? Change streams require a MongoDB 3.6 or newer server (and matching shell version if you want to test the watch() method in the shell). If possible I would recommend using a MongoDB 4.0+ server as there are some additional change stream features such as being able to watch at the database or deployment scope.

It looks like you are using the latest PyMongo driver (currently 3.8.0) which would be supported by the latest Motor release (2.0.0).

Regards,
Stennie

Marius Kriegerowski

unread,
Jul 13, 2019, 3:10:52 AM7/13/19
to mongodb-user
Dear Stennie,

That was the exact problem. Upgraded to version 4.0.10 and it worked.
Thanks for the swift reply!

Marius
Reply all
Reply to author
Forward
0 new messages