当前位置: 首页>>代码示例>>Python>>正文


Python FilterConditionService.get_mongo_query方法代码示例

本文整理汇总了Python中apps.content_filters.filter_condition.FilterConditionService.get_mongo_query方法的典型用法代码示例。如果您正苦于以下问题:Python FilterConditionService.get_mongo_query方法的具体用法?Python FilterConditionService.get_mongo_query怎么用?Python FilterConditionService.get_mongo_query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在apps.content_filters.filter_condition.FilterConditionService的用法示例。


在下文中一共展示了FilterConditionService.get_mongo_query方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_mongo_using_desk_filter_in_list

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import get_mongo_query [as 别名]
 def test_mongo_using_desk_filter_in_list(self):
     f = FilterConditionService()
     doc = {'field': 'desk', 'operator': 'in', 'value': '1,2'}
     query = f.get_mongo_query(doc)
     with self.app.app_context():
         docs = superdesk.get_resource_service('archive').\
             get_from_mongo(req=self.req, lookup=query)
         self.assertEqual(2, docs.count())
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:10,代码来源:filter_condition_tests.py

示例2: test_mongo_using_genre_filter_complete_string

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import get_mongo_query [as 别名]
 def test_mongo_using_genre_filter_complete_string(self):
     f = FilterConditionService()
     doc = {'field': 'genre', 'operator': 'in', 'value': 'Sidebar'}
     query = f.get_mongo_query(doc)
     with self.app.app_context():
         docs = superdesk.get_resource_service('archive').\
             get_from_mongo(req=self.req, lookup=query)
         self.assertEqual(1, docs.count())
         self.assertEqual('7', docs[0]['_id'])
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:11,代码来源:filter_condition_tests.py

示例3: test_mongo_using_endswith_filter

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import get_mongo_query [as 别名]
 def test_mongo_using_endswith_filter(self):
     f = FilterConditionService()
     doc = {'field': 'headline', 'operator': 'endswith', 'value': 'Que'}
     query = f.get_mongo_query(doc)
     with self.app.app_context():
         docs = superdesk.get_resource_service('archive').\
             get_from_mongo(req=self.req, lookup=query)
         self.assertEqual(1, docs.count())
         self.assertEqual('2', docs[0]['_id'])
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:11,代码来源:filter_condition_tests.py

示例4: test_mongo_using_in_filter

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import get_mongo_query [as 别名]
 def test_mongo_using_in_filter(self):
     f = FilterConditionService()
     doc = {'field': 'urgency', 'operator': 'in', 'value': '3,4'}
     query = f.get_mongo_query(doc)
     with self.app.app_context():
         docs = superdesk.get_resource_service('archive').\
             get_from_mongo(req=self.req, lookup=query)
         self.assertEqual(2, docs.count())
         self.assertEqual('3', docs[0]['_id'])
         self.assertEqual('4', docs[1]['_id'])
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:12,代码来源:filter_condition_tests.py

示例5: test_mongo_using_notlike_filter

# 需要导入模块: from apps.content_filters.filter_condition import FilterConditionService [as 别名]
# 或者: from apps.content_filters.filter_condition.FilterConditionService import get_mongo_query [as 别名]
 def test_mongo_using_notlike_filter(self):
     f = FilterConditionService()
     doc = {'field': 'headline', 'operator': 'notlike', 'value': 'Que'}
     query = f.get_mongo_query(doc)
     with self.app.app_context():
         docs = superdesk.get_resource_service('archive').\
             get_from_mongo(req=self.req, lookup=query)
         self.assertEqual(8, docs.count())
         doc_ids = [d['_id'] for d in docs]
         self.assertTrue('2' not in doc_ids)
开发者ID:MiczFlor,项目名称:superdesk-core,代码行数:12,代码来源:filter_condition_tests.py


注:本文中的apps.content_filters.filter_condition.FilterConditionService.get_mongo_query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。