我在 Django 中使用 MongoDb 进行选择查询时收到以下错误。
SELECT COUNT(*) FROM (SELECT DISTINCT "datacollection_computed_host_details"."id" AS Col1, "datacollection_computed_host_details"."HOST" AS Col2, "datacollection_computed_host_details"."TYP" AS Col3, "datacollection_computed_host_details"."isBM" AS Col4, "datacollection_computed_host_details"."Kernal" AS Col5, "datacollection_computed_host_details"."os_version" AS Col6, "datacollection_computed_host_details"."SID" AS Col7, "datacollection_computed_host_details"."DBSID" AS Col8, "datacollection_computed_host_details"."IS_VLAB" AS Col9, "datacollection_computed_host_details"."ZHCODE" AS Col10, "datacollection_computed_host_details"."DC" AS Col11, "datacollection_computed_host_details"."SYSTEMROLE" AS Col12, "datacollection_computed_host_details"."MEMORY" AS Col13, "datacollection_computed_host_details"."EUDP" AS Col14 FROM "datacollection_computed_host_details" WHERE ("datacollection_computed_host_details"."IS_VLAB" = %(0)s AND "datacollection_computed_host_details"."SID" iLIKE %(1)s)) subquery
ERROR :
djongo.sql2mongo.SQLDecodeError:
Version: 1.2.33
Django Version 2.1.8
Python 3.7.2
背景 :
我正在开发一个使用 rest_framework_datatables 进行数据表集成的 Django 项目。我能够在前端接收数据并能够对数据进行排序。但是当我应用搜索时,我在 Django 方面得到了 500。如果你能帮我解决这个问题,那就太好了。我被困了一个多星期。
我认为这是一个 MongoDB 错误:我在https://github.com/nesdis/djongo/issues/156中看到了回复
由于我是 django 和 MongoDB 的新手,我无法执行您的解决方案。
MongoDB error :
djongo.sql2mongo.SQLDecodeError: FAILED SQL: SELECT COUNT(*) FROM (SELECT DISTINCT "datacollection_computed_host_details"."id" AS Col1, "datacollection_computed_host_details"."HOST" AS Col2, "datacollection_computed_host_details"."TYP" AS Col3, "datacollection_computed_host_details"."isBM" AS Col4, "datacollection_computed_host_details"."Kernal" AS Col5, "datacollection_computed_host_details"."os_version" AS Col6, "datacollection_computed_host_details"."SID" AS Col7, "datacollection_computed_host_details"."DBSID" AS Col8, "datacollection_computed_host_details"."IS_VLAB" AS Col9, "datacollection_computed_host_details"."ZHCODE" AS Col10, "datacollection_computed_host_details"."DC" AS Col11, "datacollection_computed_host_details"."SYSTEMROLE" AS Col12, "datacollection_computed_host_details"."MEMORY" AS Col13, "datacollection_computed_host_details"."EUDP" AS Col14 FROM "datacollection_computed_host_details" WHERE ("datacollection_computed_host_details"."IS_VLAB" = %(0)s AND "datacollection_computed_host_details"."SID" iLIKE %(1)s)) subquery
Params: (False, '%E39%')
提前致谢
谢谢和问候, 穆罕默德·纳文