コード例 #1
0
    def set_collection(cls, collection_name):
        """Return a MongoDB collection for the passed name.

        :param collection_name: The name of collection to return.

        :returns: A MongoDB collection from the current database.
        """
        return Database.db()[collection_name]
コード例 #2
0
    def set_collection(cls, collection_name):
        """Return a MongoDB collection for the passed name.

        :param collection_name: The name of collection to return.

        :returns: A MongoDB collection from the current database.
        """
        return Database.db()[collection_name]
コード例 #3
0
ファイル: mongo_index.py プロジェクト: sparkplug/bamboo
def ensure_indexing():
    """Ensure that bamboo models are indexed."""
    db = Database.db()
    calculations = db.calculations
    datasets = db.datasets
    observations = db.observations
    datasets.ensure_index([(DATASET_ID, ASCENDING)])
    # The encoded dataset_id will be set to '0'.
    observations.ensure_index([("0", ASCENDING)])
    observations.ensure_index([(Observation.ENCODING_DATASET_ID, ASCENDING)])
    calculations.ensure_index([(DATASET_ID, ASCENDING)])
コード例 #4
0
ファイル: mongo_index.py プロジェクト: astrorobotics/bamboo
def ensure_indexing():
    """Ensure that bamboo models are indexed."""
    db = Database.db()
    calculations = db.calculations
    datasets = db.datasets
    observations = db.observations
    datasets.ensure_index([
        ("BAMBOO_RESERVED_KEY_dataset_id", ASCENDING),
        ("BAMBOO_RESERVED_KEY_dataset_observation_id", ASCENDING)])
    observations.ensure_index([
        ("BAMBOO_RESERVED_KEY_dataset_observation_id", ASCENDING)])
    calculations.ensure_index([("BAMBOO_RESERVED_KEY_dataset_id", ASCENDING)])
コード例 #5
0
def ensure_indexing():
    """Ensure that bamboo models are indexed."""
    db = Database.db()

    # collections
    calculations = db.calculations
    datasets = db.datasets
    observations = db.observations

    # indices
    bamboo_index(datasets, DATASET_ID)
    bamboo_index(observations, ENCODED_DATASET_ID)
    bamboo_index(observations, Observation.ENCODING_DATASET_ID)
    bamboo_index(calculations, DATASET_ID)
コード例 #6
0
ファイル: test_base.py プロジェクト: j/bamboo
 def __create_database(self):
     Database.db(TEST_DATABASE_NAME)
コード例 #7
0
 def __create_database(self):
     Database.db(TEST_DATABASE_NAME)