python的collection_Python collection.Collection方法代码示例

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

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

示例1: test_mongo_date_range_query

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_mongo_date_range_query():

self = create_autospec(TickStore)

self._collection = create_autospec(Collection)

self._symbol_query.return_value = {"sy": {"$in" : ["s1" , "s2"]}}

self._collection.aggregate.return_value = iter([{"_id": "s1", "start": dt(2014, 1, 1, 0, 0, tzinfo=mktz())},

{"_id": "s2", "start": dt(2014, 1, 1, 12, 0, tzinfo=mktz())}])

self._collection.find_one.side_effect = [

{'e': dt(2014, 1, 1, 15, 0, tzinfo=mktz())},

{'e': dt(2014, 1, 2, 12, 0, tzinfo=mktz())}]

query = TickStore._mongo_date_range_query(self, 'sym', DateRange(dt(2014, 1, 2, 0, 0, tzinfo=mktz()),

dt(2014, 1, 3, 0, 0, tzinfo=mktz())))

assert self._collection.aggregate.call_args_list == [call([

{"$match": {"s": {"$lte": dt(2014, 1, 2, 0, 0, tzinfo=mktz())}, "sy": {"$in" : ["s1" , "s2"]}}},

{"$project": {"_id": 0, "s": 1, "sy": 1}},

{"$group": {"_id": "$sy", "start": {"$max": "$s"}}},

{"$sort": {"start": 1}}])]

assert self._collection.find_one.call_args_list == [

call({'sy': 's1', 's': dt(2014, 1, 1, 0, 0, tzinfo=mktz())}, {'e': 1}),

call({'sy': 's2', 's': dt(2014, 1, 1, 12, 0, tzinfo=mktz())}, {'e': 1})]

assert query == {'s': {'$gte': dt(2014, 1, 1, 12, 0, tzinfo=mktz()), '$lte': dt(2014, 1, 3, 0, 0, tzinfo=mktz())}}

开发者ID:man-group,项目名称:arctic,代码行数:27,

示例2: test_concat_and_rewrite_checks_chunk_count

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_concat_and_rewrite_checks_chunk_count():

self = create_autospec(NdarrayStore)

collection = create_autospec(Collection)

version = {}

previous_version = {'_id': sentinel.id,

'base_version_id': sentinel.base_version_id,

'version': sentinel.version,

'segment_count' : 3,

'append_count' : 1,

'up_to': sentinel.up_to}

symbol = sentinel.symbol

item = sentinel.item

collection.find.return_value = [{'compressed': True, 'segment': 1},

{'compressed': False, 'segment': 2}]

with pytest.raises(DataIntegrityException) as e:

NdarrayStore._concat_and_rewrite(self, collection, version, symbol, item, previous_version)

assert str(e.value) == 'Symbol: sentinel.symbol:sentinel.version expected 1 segments but found 0'

开发者ID:man-group,项目名称:arctic,代码行数:20,

示例3: test_concat_and_rewrite_checks_written

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_concat_and_rewrite_checks_written():

self = create_autospec(NdarrayStore)

collection = create_autospec(Collection)

version = {'_id': sentinel.version_id,

'segment_count': 1}

previous_version = {'_id': sentinel.id,

'up_to': sentinel.up_to,

'base_version_id': sentinel.base_version_id,

'version': sentinel.version,

'segment_count' : 5,

'append_count' : 3}

symbol = sentinel.symbol

item = []

collection.find.return_value = [{'_id': sentinel.id, 'segment': 47, 'compressed': True, 'sha': 'abc0'},

{'_id': sentinel.id_2, 'segment': 48, 'compressed': True, 'sha': 'abc1'},

# 3 appended items

{'_id': sentinel.id_3, 'segment': 49, 'compressed': False, 'sha': 'abc2'},

{'_id': sentinel.id_4, 'segment': 50, 'compressed': False, 'sha': 'abc3'},

{'_id': sentinel.id_5, 'segment': 51, 'compressed': False, 'sha': 'abc4'}]

collection.update_many.return_value = create_autospec(UpdateResult, matched_count=1)

NdarrayStore._concat_and_rewrite(self, collection, version, symbol, item, previous_version)

assert self.check_written.call_count == 1

开发者ID:man-group,项目名称:arctic,代码行数:25,

示例4: test_prune_previous_versions_0_timeout

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_prune_previous_versions_0_timeout():

self = create_autospec(VersionStore, _versions=Mock())

self.name = sentinel.name

self._versions = create_autospec(Collection)

self._versions.with_options.return_value.find.__name__ = 'find'

self._versions.with_options.return_value.find.return_value = []

with patch('arctic.store.version_store.dt') as dt:

dt.utcnow.return_value = datetime.datetime(2013, 10, 1)

VersionStore._find_prunable_version_ids(self, sentinel.symbol, keep_mins=0)

assert self._versions.with_options.call_args_list == [call(read_preference=ReadPreference.PRIMARY)]

assert self._versions.with_options.return_value.find.call_args_list == [

call({'$or': [{'parent': {'$exists': False}},

{'parent': []}],

'symbol': sentinel.symbol,

'_id': {'$lt': bson.ObjectId('524a10810000000000000000')}},

sort=[('version', -1)],

skip=1,

projection={'FW_POINTERS_CONFIG': 1, '_id': 1, 'SEGMENT_SHAS': 1}

)]

开发者ID:man-group,项目名称:arctic,代码行数:21,

示例5: test_read_handles_operation_failure

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_read_handles_operation_failure():

self = Mock(spec=VersionStore)

self._read_preference.return_value = sentinel.read_preference

self._collection = create_autospec(Collection)

self._read_metadata.side_effect = [sentinel.meta1, sentinel.meta2]

self._read_metadata.__name__ = 'name'

self._do_read.__name__ = 'name' # feh: mongo_retry decorator cares about this

self._do_read.side_effect = [OperationFailure('error'), sentinel.read]

VersionStore.read(self, sentinel.symbol, sentinel.as_of,

from_version=sentinel.from_version,

date_range=sentinel.date_range,

other_kwarg=sentinel.other_kwarg)

# Assert that, for the two read calls, the second uses the new metadata

assert self._do_read.call_args_list == [call(sentinel.symbol, sentinel.meta1,

sentinel.from_version,

date_range=sentinel.date_range,

other_kwarg=sentinel.other_kwarg,

read_preference=sentinel.read_preference)]

assert self._do_read_retry.call_args_list == [call(sentinel.symbol, sentinel.meta2,

sentinel.from_version,

date_range=sentinel.date_range,

other_kwarg=sentinel.other_kwarg,

read_preference=ReadPreference.PRIMARY)]

开发者ID:man-group,项目名称:arctic,代码行数:25,

示例6: drop_collection

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def drop_collection(self, name_or_collection):

"""Drop a collection.

:Parameters:

- `name_or_collection`: the name of a collection to drop or the

collection object itself

"""

name = name_or_collection

if isinstance(name, Collection):

name = name.name

if not isinstance(name, str):

raise TypeError("name_or_collection must be an instance of "

"%s or Collection" % (str.__name__,))

self.__connection._purge_index(self.__name, name)

self.command("drop", str(name), allowable_errors=["ns not found"],

read_preference=ReadPreference.PRIMARY)

开发者ID:Frank-qlu,项目名称:recruit,代码行数:21,

示例7: dereference

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def dereference(self, dbref, **kwargs):

"""Dereference a :class:`~bson.dbref.DBRef`, getting the

document it points to.

Raises :class:`TypeError` if `dbref` is not an instance of

:class:`~bson.dbref.DBRef`. Returns a document, or ``None`` if

the reference does not point to a valid document. Raises

:class:`ValueError` if `dbref` has a database specified that

is different from the current database.

:Parameters:

- `dbref`: the reference

- `**kwargs` (optional): any additional keyword arguments

are the same as the arguments to

:meth:`~pymongo.collection.Collection.find`.

"""

if not isinstance(dbref, DBRef):

raise TypeError("cannot dereference a %s" % type(dbref))

if dbref.database is not None and dbref.database != self.__name:

raise ValueError("trying to dereference a DBRef that points to "

"another database (%r not %r)" % (dbref.database,

self.__name))

return self[dbref.collection].find_one({"_id": dbref.id}, **kwargs)

开发者ID:Frank-qlu,项目名称:recruit,代码行数:25,

示例8: restore_pymongo

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def restore_pymongo():

"""Restores pymongo"""

try:

from pymongo.collection import Collection

except ImportError: # pragma: no cover

pass

else:

for class_method in (

"bulk_write",

"delete_many",

"delete_one",

"insert_many",

"insert_one",

"replace_one",

"update_many",

"update_one",

):

if hasattr(getattr(Collection, class_method), "__wrapped__"):

setattr(

Collection,

class_method,

getattr(Collection, class_method).__wrapped__,

)

开发者ID:iopipe,项目名称:iopipe-python,代码行数:25,

示例9: load_mongo_col

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def load_mongo_col(col: Collection) -> dict:

"""Load the pymongo collection to a dictionary.

In the dictionary. The key will be the '_id' and in each value which is a dictionary there will also be a

key '_id' so that the structure will be the same as the filesystem collection.

Parameters

----------

col : Collection

The mongodb collection.

Returns

-------

dct : dict

A dictionary with all the info in the collection.

"""

return {

doc['_id']: doc for doc in col.find({})

}

开发者ID:regro,项目名称:regolith,代码行数:21,

示例10: ensure_installed

​点赞 6

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def ensure_installed():

global have_patched_collection

logger.debug("Instrumenting pymongo.")

if Collection is None:

logger.debug("Couldn't import pymongo.Collection - probably not installed.")

elif not have_patched_collection:

for name in COLLECTION_METHODS:

try:

setattr(

Collection, name, wrap_collection_method(getattr(Collection, name))

)

except Exception as exc:

logger.warning(

"Failed to instrument pymongo.Collection.%s: %r",

name,

exc,

exc_info=exc,

)

have_patched_collection = True

开发者ID:scoutapp,项目名称:scout_apm_python,代码行数:23,

示例11: test_mongo_date_range_query_asserts

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_mongo_date_range_query_asserts():

self = create_autospec(TickStore)

self._collection = create_autospec(Collection)

self._collection.find_one.return_value = {'s': sentinel.start}

with pytest.raises(AssertionError):

TickStore._mongo_date_range_query(self, 'sym', DateRange(None, None, CLOSED_OPEN))

with pytest.raises(AssertionError):

TickStore._mongo_date_range_query(self, 'sym', DateRange(dt(2014, 1, 1), None))

with pytest.raises(AssertionError):

TickStore._mongo_date_range_query(self, 'sym', DateRange(None, dt(2014, 1, 1)))

开发者ID:man-group,项目名称:arctic,代码行数:14,

示例12: test_concat_and_rewrite_checks_different_id

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_concat_and_rewrite_checks_different_id():

self = create_autospec(NdarrayStore)

collection = create_autospec(Collection)

version = {'_id': sentinel.version_id,

'segment_count': 1}

previous_version = {'_id': sentinel.id,

'up_to': sentinel.up_to,

'base_version_id': sentinel.base_version_id,

'version': sentinel.version,

'segment_count' : 5,

'append_count' : 3}

symbol = sentinel.symbol

item = []

collection.find.side_effect = [

[{'_id': sentinel.id, 'segment' : 47, 'compressed': True},

{'_id': sentinel.id_3, 'segment': 48, 'compressed': True},

{'_id': sentinel.id_4, 'segment': 49, 'compressed': False},

{'_id': sentinel.id_5, 'segment': 50, 'compressed': False},

{'_id': sentinel.id_6, 'segment': 51, 'compressed': False}], # 3 appended items

[{'_id': sentinel.id_2}] # the returned id is different after the update_many

]

expected_verify_find_spec = {'symbol': sentinel.symbol, 'segment': {'$lte': 47}, 'parent': sentinel.version_id}

collection.update_many.return_value = create_autospec(UpdateResult, matched_count=0)

with pytest.raises(DataIntegrityException) as e:

NdarrayStore._concat_and_rewrite(self, collection, version, symbol, item, previous_version)

assert collection.find.call_args_list[1] == call(expected_verify_find_spec)

assert str(e.value) == 'Symbol: sentinel.symbol:sentinel.version update_many updated 0 segments instead of 1'

开发者ID:man-group,项目名称:arctic,代码行数:32,

示例13: test_read_reports_random_errors

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_read_reports_random_errors():

self = create_autospec(VersionStore, _versions=Mock(), _arctic_lib=Mock(),

_allow_secondary=True)

self._collection = create_autospec(Collection)

self._do_read.__name__ = 'name' # feh: mongo_retry decorator cares about this

self._do_read.side_effect = Exception('bad')

with pytest.raises(Exception) as e:

with patch('arctic.store.version_store.log_exception') as le:

VersionStore.read(self, sentinel.symbol, sentinel.as_of, sentinel.from_version)

assert 'bad' in str(e.value)

assert le.call_count == 1

开发者ID:man-group,项目名称:arctic,代码行数:13,

示例14: test_find

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_find():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

collection.find.return_value = (doc for doc in [sentinel.document])

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

assert list(bsons.find(sentinel.filter)) == [sentinel.document]

assert collection.find.call_count == 1

assert collection.find.call_args_list == [call(sentinel.filter)]

开发者ID:man-group,项目名称:arctic,代码行数:13,

示例15: test_find_one

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_find_one():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

collection.find_one.return_value = sentinel.document

arctic_lib.get_top_level_collection.return_value = collection

ms = BSONStore(arctic_lib)

assert ms.find_one(sentinel.filter) == sentinel.document

assert collection.find_one.call_count == 1

assert collection.find_one.call_args_list == [call(sentinel.filter)]

开发者ID:man-group,项目名称:arctic,代码行数:13,

示例16: test_insert_many

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_insert_many():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.insert_many(sentinel.documents)

assert arctic_lib.check_quota.call_count == 1

assert collection.insert_many.call_count == 1

assert collection.insert_many.call_args_list == [call(sentinel.documents)]

开发者ID:man-group,项目名称:arctic,代码行数:13,

示例17: test_replace_one

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_replace_one():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.replace_one(sentinel.filter, sentinel.replacement)

assert arctic_lib.check_quota.call_count == 1

assert collection.replace_one.call_count == 1

assert collection.replace_one.call_args_list == [call(sentinel.filter, sentinel.replacement)]

开发者ID:man-group,项目名称:arctic,代码行数:13,

示例18: test_update_one

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_update_one():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.update_one(sentinel.filter, sentinel.replacement)

assert arctic_lib.check_quota.call_count == 1

assert collection.update_one.call_count == 1

assert collection.update_one.call_args_list == [call(sentinel.filter, sentinel.replacement)]

开发者ID:man-group,项目名称:arctic,代码行数:13,

示例19: test_update_many

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_update_many():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.update_many(sentinel.filter, sentinel.replacements)

assert arctic_lib.check_quota.call_count == 1

assert collection.update_many.call_count == 1

assert collection.update_many.call_args_list == [call(sentinel.filter, sentinel.replacements)]

开发者ID:man-group,项目名称:arctic,代码行数:13,

示例20: test_find_one_and_replace

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_find_one_and_replace():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.find_one_and_replace(sentinel.filter, sentinel.replacement)

assert arctic_lib.check_quota.call_count == 1

assert collection.find_one_and_replace.call_count == 1

assert collection.find_one_and_replace.call_args_list == [call(sentinel.filter, sentinel.replacement)]

开发者ID:man-group,项目名称:arctic,代码行数:13,

示例21: test_find_one_and_delete

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_find_one_and_delete():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

ms = BSONStore(arctic_lib)

ms.find_one_and_delete(sentinel.filter)

assert collection.find_one_and_delete.call_count == 1

assert collection.find_one_and_delete.call_args_list == [call(sentinel.filter)]

开发者ID:man-group,项目名称:arctic,代码行数:12,

示例22: test_bulk_write

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_bulk_write():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.bulk_write(sentinel.requests)

assert arctic_lib.check_quota.call_count == 1

assert collection.bulk_write.call_count == 1

assert collection.bulk_write.call_args_list == [call(sentinel.requests)]

开发者ID:man-group,项目名称:arctic,代码行数:13,

示例23: test_delete_one

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_delete_one():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.delete_one(sentinel.filter)

assert collection.delete_one.call_count == 1

assert collection.delete_one.call_args_list == [call(sentinel.filter)]

开发者ID:man-group,项目名称:arctic,代码行数:12,

示例24: test_count

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_count():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True, count=Mock(), count_documents=Mock())

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.count(sentinel.filter)

assert collection.count.call_count + collection.count_documents.call_count == 1

assert collection.count.call_args_list == [call(filter=sentinel.filter)] or collection.count_documents.call_args_list == [call(filter=sentinel.filter)]

开发者ID:man-group,项目名称:arctic,代码行数:12,

示例25: test_distinct

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_distinct():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.distinct(sentinel.key)

assert collection.distinct.call_count == 1

assert collection.distinct.call_args_list == [call(sentinel.key)]

开发者ID:man-group,项目名称:arctic,代码行数:12,

示例26: test_create_index

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_create_index():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.create_index([(sentinel.path1, sentinel.order1), (sentinel.path2, sentinel.path2)])

assert collection.create_index.call_count == 1

assert collection.create_index.call_args_list == [call([(sentinel.path1, sentinel.order1), (sentinel.path2, sentinel.path2)])]

开发者ID:man-group,项目名称:arctic,代码行数:12,

示例27: test_drop_index

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_drop_index():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.drop_index(sentinel.name)

assert collection.drop_index.call_count == 1

assert collection.drop_index.call_args_list == [call(sentinel.name)]

开发者ID:man-group,项目名称:arctic,代码行数:12,

示例28: test_index_information

​点赞 5

# 需要导入模块: from pymongo import collection [as 别名]

# 或者: from pymongo.collection import Collection [as 别名]

def test_index_information():

arctic_lib = create_autospec(ArcticLibraryBinding, instance=True)

collection = create_autospec(Collection, instance=True)

arctic_lib.get_top_level_collection.return_value = collection

bsons = BSONStore(arctic_lib)

bsons.index_information()

assert collection.index_information.call_count == 1

开发者ID:man-group,项目名称:arctic,代码行数:11,

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值