本文整理匯總了Python中eve.io.mongo.Mongo.query_contains_field方法的典型用法代碼示例。如果您正苦於以下問題:Python Mongo.query_contains_field方法的具體用法?Python Mongo.query_contains_field怎麽用?Python Mongo.query_contains_field使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類eve.io.mongo.Mongo
的用法示例。
在下文中一共展示了Mongo.query_contains_field方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_query_contains_field
# 需要導入模塊: from eve.io.mongo import Mongo [as 別名]
# 或者: from eve.io.mongo.Mongo import query_contains_field [as 別名]
def test_query_contains_field(self):
mongo = Mongo(None)
simple_query = {"_id": "abcdef012345678901234567"}
compound_query = {
"$and": [
{"username": {"$exists": False}},
{"_id": "abcdef012345678901234567"},
]
}
self.assertTrue(mongo.query_contains_field(simple_query, "_id"))
self.assertFalse(mongo.query_contains_field(simple_query, "fake-field"))
self.assertTrue(mongo.query_contains_field(compound_query, "_id"))
self.assertFalse(mongo.query_contains_field(compound_query, "fake-field"))
示例2: test_query_contains_field
# 需要導入模塊: from eve.io.mongo import Mongo [as 別名]
# 或者: from eve.io.mongo.Mongo import query_contains_field [as 別名]
def test_query_contains_field(self):
mongo = Mongo(None)
simple_query = {'_id': 'abcdef012345678901234567'}
compound_query = {'$and': [
{'username': {'$exists': False}},
{'_id': 'abcdef012345678901234567'}
]}
self.assertTrue(mongo.query_contains_field(simple_query, '_id'))
self.assertFalse(mongo.query_contains_field(simple_query,
'fake-field'))
self.assertTrue(mongo.query_contains_field(compound_query, '_id'))
self.assertFalse(mongo.query_contains_field(compound_query,
'fake-field'))