doableware / djongo

Django and MongoDB database connector
https://www.djongomapper.com
GNU Affero General Public License v3.0
1.89k stars 355 forks source link

Unrecognized pipeline stage name: '$count' #51

Closed barseghyanartur closed 6 years ago

barseghyanartur commented 6 years ago

Unrecognized pipeline stage name: '$count'

Python script

python manage.py runserver

Standard Django, contrib user admin:

http://0.0.0.0:8000/admin/auth/user/

The error:


Request Method: | GET
-- | --
http://0.0.0.0:8001/en/admin/auth/user/
1.11.9
OperationFailure
Unrecognized pipeline stage name: '$count'
/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/pymongo/helpers.py in _check_command_response, line 146
/home/me/.virtualenvs/django-fobi/bin/python
3.6.2
['/home/me/bbrepos/django-fobi/src',  '/home/me/bbrepos/django-fobi/examples/simple',  '/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/vishap-0.1.5-py3.6.egg',  '/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/Unidecode-0.4.21-py3.6.egg',  '/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django_nonefield-0.2-py3.6.egg',  '/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django_nine-0.1.13-py3.6.egg',  '/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django_autoslug_iplweb-1.9.4.dev0-py3.6.egg',  '/home/me/.virtualenvs/django-fobi/lib/python36.zip',  '/home/me/.virtualenvs/django-fobi/lib/python3.6',  '/home/me/.virtualenvs/django-fobi/lib/python3.6/lib-dynload',  '/usr/lib/python3.6',  '/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages']
Sun, 14 Jan 2018 14:26:21 -0600

Traceback

Environment:

Request Method: GET
Request URL: http://0.0.0.0:8001/en/admin/auth/user/

Django Version: 1.11.9
Python Version: 3.6.2
Installed Applications:
['django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.sitemaps',
 'easy_thumbnails',
 'registration',
 'captcha',
 'ckeditor',
 'fobi.reusable.markdown_widget',
 'fobi',
 'fobi.contrib.plugins.form_elements.fields.boolean',
 'fobi.contrib.plugins.form_elements.fields.checkbox_select_multiple',
 'fobi.contrib.plugins.form_elements.fields.date',
 'fobi.contrib.plugins.form_elements.fields.date_drop_down',
 'fobi.contrib.plugins.form_elements.fields.datetime',
 'fobi.contrib.plugins.form_elements.fields.decimal',
 'fobi.contrib.plugins.form_elements.fields.duration',
 'fobi.contrib.plugins.form_elements.fields.email',
 'fobi.contrib.plugins.form_elements.fields.file',
 'fobi.contrib.plugins.form_elements.fields.float',
 'fobi.contrib.plugins.form_elements.fields.hidden',
 'fobi.contrib.plugins.form_elements.fields.input',
 'fobi.contrib.plugins.form_elements.fields.integer',
 'fobi.contrib.plugins.form_elements.fields.ip_address',
 'fobi.contrib.plugins.form_elements.fields.null_boolean',
 'fobi.contrib.plugins.form_elements.fields.password',
 'fobi.contrib.plugins.form_elements.fields.radio',
 'fobi.contrib.plugins.form_elements.fields.range_select',
 'fobi.contrib.plugins.form_elements.fields.regex',
 'fobi.contrib.plugins.form_elements.fields.select',
 'fobi.contrib.plugins.form_elements.fields.select_model_object',
 'fobi.contrib.plugins.form_elements.fields.select_multiple',
 'fobi.contrib.plugins.form_elements.fields.select_multiple_with_max',
 'fobi.contrib.plugins.form_elements.fields.select_multiple_model_objects',
 'fobi.contrib.plugins.form_elements.fields.slider',
 'fobi.contrib.plugins.form_elements.fields.slug',
 'fobi.contrib.plugins.form_elements.fields.text',
 'fobi.contrib.plugins.form_elements.fields.textarea',
 'fobi.contrib.plugins.form_elements.fields.time',
 'fobi.contrib.plugins.form_elements.fields.url',
 'fobi.contrib.plugins.form_elements.security.honeypot',
 'fobi.contrib.plugins.form_elements.test.dummy',
 'fobi.contrib.plugins.form_elements.content.content_image',
 'fobi.contrib.plugins.form_elements.content.content_image_url',
 'fobi.contrib.plugins.form_elements.content.content_markdown',
 'fobi.contrib.plugins.form_elements.content.content_text',
 'fobi.contrib.plugins.form_elements.content.content_richtext',
 'fobi.contrib.plugins.form_elements.content.content_video',
 'fobi.contrib.plugins.form_handlers.db_store',
 'fobi.contrib.plugins.form_handlers.http_repost',
 'fobi.contrib.plugins.form_handlers.mail',
 'fobi.contrib.plugins.form_importers.mailchimp_importer',
 'fobi.contrib.themes.bootstrap3',
 'fobi.contrib.themes.bootstrap3.widgets.form_elements.datetime_bootstrap3_widget',
 'fobi.contrib.themes.bootstrap3.widgets.form_elements.date_bootstrap3_widget',
 'fobi.contrib.themes.bootstrap3.widgets.form_elements.slider_bootstrap3_widget',
 'fobi.contrib.themes.bootstrap3.widgets.form_elements.content_richtext_bootstrap3_widget',
 'fobi.contrib.themes.foundation5',
 'fobi.contrib.themes.foundation5.widgets.form_handlers.db_store_foundation5_widget',
 'fobi.contrib.themes.simple',
 'rest_framework',
 'fobi.contrib.apps.drf_integration',
 'fobi.contrib.apps.drf_integration.form_elements.fields.boolean',
 'fobi.contrib.apps.drf_integration.form_elements.fields.checkbox_select_multiple',
 'fobi.contrib.apps.drf_integration.form_elements.fields.date',
 'fobi.contrib.apps.drf_integration.form_elements.fields.date_drop_down',
 'fobi.contrib.apps.drf_integration.form_elements.fields.datetime',
 'fobi.contrib.apps.drf_integration.form_elements.fields.decimal',
 'fobi.contrib.apps.drf_integration.form_elements.fields.duration',
 'fobi.contrib.apps.drf_integration.form_elements.fields.email',
 'fobi.contrib.apps.drf_integration.form_elements.fields.file',
 'fobi.contrib.apps.drf_integration.form_elements.fields.float',
 'fobi.contrib.apps.drf_integration.form_elements.fields.hidden',
 'fobi.contrib.apps.drf_integration.form_elements.fields.input',
 'fobi.contrib.apps.drf_integration.form_elements.fields.integer',
 'fobi.contrib.apps.drf_integration.form_elements.fields.ip_address',
 'fobi.contrib.apps.drf_integration.form_elements.fields.null_boolean',
 'fobi.contrib.apps.drf_integration.form_elements.fields.password',
 'fobi.contrib.apps.drf_integration.form_elements.fields.radio',
 'fobi.contrib.apps.drf_integration.form_elements.fields.range_select',
 'fobi.contrib.apps.drf_integration.form_elements.fields.regex',
 'fobi.contrib.apps.drf_integration.form_elements.fields.select',
 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple',
 'fobi.contrib.apps.drf_integration.form_elements.fields.select_multiple_with_max',
 'fobi.contrib.apps.drf_integration.form_elements.fields.slider',
 'fobi.contrib.apps.drf_integration.form_elements.fields.slug',
 'fobi.contrib.apps.drf_integration.form_elements.fields.text',
 'fobi.contrib.apps.drf_integration.form_elements.fields.textarea',
 'fobi.contrib.apps.drf_integration.form_elements.fields.time',
 'fobi.contrib.apps.drf_integration.form_elements.fields.url',
 'fobi.contrib.apps.drf_integration.form_elements.content.content_image',
 'fobi.contrib.apps.drf_integration.form_elements.content.content_image_url',
 'fobi.contrib.apps.drf_integration.form_elements.content.content_markdown',
 'fobi.contrib.apps.drf_integration.form_elements.content.content_richtext',
 'fobi.contrib.apps.drf_integration.form_elements.content.content_text',
 'fobi.contrib.apps.drf_integration.form_elements.content.content_video',
 'fobi.contrib.apps.drf_integration.form_handlers.db_store',
 'fobi.contrib.apps.drf_integration.form_handlers.mail',
 'fobi.contrib.apps.drf_integration.form_handlers.http_repost',
 'foo']
Installed Middleware:
['django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware']

Traceback:

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/core/handlers/exception.py" in inner
  41.             response = get_response(request)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/core/handlers/base.py" in _legacy_get_response
  249.             response = self._get_response(request)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  187.                 response = self.process_exception_by_middleware(e, request)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/core/handlers/base.py" in _get_response
  185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/contrib/admin/options.py" in wrapper
  551.                 return self.admin_site.admin_view(view)(*args, **kwargs)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/views/decorators/cache.py" in _wrapped_view_func
  57.         response = view_func(request, *args, **kwargs)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/contrib/admin/sites.py" in inner
  224.             return view(request, *args, **kwargs)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapper
  67.             return bound_func(*args, **kwargs)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/utils/decorators.py" in _wrapped_view
  149.                     response = view_func(request, *args, **kwargs)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/utils/decorators.py" in bound_func
  63.                 return func.__get__(self, type(self))(*args2, **kwargs2)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/contrib/admin/options.py" in changelist_view
  1542.                 self.list_max_show_all, self.list_editable, self,

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/contrib/admin/views/main.py" in __init__
  79.         self.get_results(request)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/contrib/admin/views/main.py" in get_results
  177.         result_count = paginator.count

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/utils/functional.py" in __get__
  35.         res = instance.__dict__[self.name] = self.func(instance)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/core/paginator.py" in count
  79.             return self.object_list.count()

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/db/models/query.py" in count
  364.         return self.query.get_count(using=self.db)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/db/models/sql/query.py" in get_count
  499.         number = obj.get_aggregation(using, ['__count'])['__count']

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/db/models/sql/query.py" in get_aggregation
  480.         result = compiler.execute_sql(SINGLE)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/db/models/sql/compiler.py" in execute_sql
  907.                 val = cursor.fetchone()

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/django/db/utils.py" in inner
  101.                 return func(*args, **kwargs)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/djongo/cursor.py" in fetchone
  58.             return self.result.next()

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/djongo/sql2mongo.py" in __next__
  838.         return next(self._result_generator)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/djongo/sql2mongo.py" in __iter__
  851.             raise e

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/djongo/sql2mongo.py" in __iter__
  844.             yield from iter(self._query)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/djongo/sql2mongo.py" in __iter__
  561.             self._cursor = self._get_cursor()

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/djongo/sql2mongo.py" in _get_cursor
  642.             cur = self.db_ref[self.left_table].aggregate(pipeline)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/pymongo/collection.py" in aggregate
  2181.                                    **kwargs)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/pymongo/collection.py" in _aggregate
  2088.                 client=self.__database.client)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/pymongo/pool.py" in command
  496.                            collation=collation)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/pymongo/network.py" in command
  125.                 parse_write_concern_error=parse_write_concern_error)

File "/home/me/.virtualenvs/django-fobi/lib/python3.6/site-packages/pymongo/helpers.py" in _check_command_response
  146.             raise OperationFailure(msg % errmsg, code, response)

Exception Type: OperationFailure at /en/admin/auth/user/
Exception Value: Unrecognized pipeline stage name: '$count'
nesdis commented 6 years ago

Which version of Mongodb do you use? that is strange because count operator is part of Mongodb.

Do you see any print saying 'FAILED SQL in your output?

I am able to access users collection using Admin interface.

barseghyanartur commented 6 years ago

@nesdis:

3.2

barseghyanartur commented 6 years ago

@nesdis:

I confirm, that it works on 3.6. Sorry, my bad. I didn't read the prerequisites carefully, where it is mentioned that version 3.4 or greater is required.

nesdis commented 6 years ago

It works on 3.4 too

On 15-Jan-2018 1:53 PM, "Artur Barseghyan" notifications@github.com wrote:

Closed #51 https://github.com/nesdis/djongo/issues/51.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nesdis/djongo/issues/51#event-1423847762, or mute the thread https://github.com/notifications/unsubscribe-auth/AQO4BLQFA8ISL8jdUo_G3ABTSqtp8VChks5tKwsPgaJpZM4Rduds .

d6tdev commented 5 years ago

Got this when installed ubuntu default mongo 3.2 instead of latest mongo as per https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/