Пример #1
0
    def __init__(self):
        config = Config()
        connect(config.database()['database'],
                host=config.database()['host'],
                port=config.database()['port'])

        self.client = MongoClient('localhost', 27017)
        self.db = self.client['mongoengine_test']

        self.filecollection = self.db.get_collection("file")
        self.usercollection = self.db.get_collection("user")
        self.vdircollection = self.db.get_collection("virtualdirectory")

        self.fileproperty = generate("File")
        self.userproperty = generate("User")
        self.vdirproperty = generate("Virtualdirectory")
Пример #2
0
from mongoengine import *
import datetime
from pymongo import MongoClient

from cloudmesh_data.data.Config import Config
from cloudmesh_data.data.util.retrieve_yaml_definition_properties import generate
from cloudmesh_data.data.util import get_file_size_and_checksum

#
# BUG: needs to come from config
#
config = Config()
connect(config.database()['database'],
        host=config.database()['host'],
        port=config.database()['port'])

client = MongoClient('localhost', 27017)
db = client['mongoengine_test']

filecollection = db.get_collection("file")
usercollection = db.get_collection("user")
vdircollection = db.get_collection("virtualdirectory")

# To print all records for file table
# for file in vdircollection.find():
# print(file)
# To delete all records
# myquery = {}
# usercollection.delete_many({})

fileproperty = generate("File")