示例#1
0
	def __init__(self, address, port, username, password, database_name, collection_name):
		BaseCollection.__init__(self)
		self.mongo = pymongo.MongoClient(address, int(port))
		self.mongo_database = self.mongo[database_name]
		self.mongo_collection = self.mongo_database[collection_name]
		if username and password:
			self.mongo_database.authenticate(username, password)
示例#2
0
 def __init__(self, filepath):
     BaseCollection.__init__(self)
     self.filepath = filepath
     if not os.path.isfile(filepath):
         raise IOError(
             filepath,
             'BsonCollection could not find your file, it\'s mispelled or doesn\'t exist.'
         )
示例#3
0
 def __init__(self, *args, **kwargs):
     BaseCollection.__init__(self)
     if 'passed_mongo' in kwargs:
         self.mongo = kwargs['passed_mongo']
         self.mongo_database = self.mongo[args[2]]
         if args[0] and args[1]:
             self.mongo_database.authenticate(args[0], args[1])
         self.mongo_collection = self.mongo_database[args[3]]
     else:
         self.mongo = pymongo.MongoClient(args[0], int(args[1]))
         self.mongo_database = self.mongo[args[4]]
         if args[2] and args[3]:
             self.mongo_database.authenticate(args[2], args[3])
         self.mongo_collection = self.mongo_database[args[5]]
示例#4
0
	def __init__(self, *args, **kwargs):
		BaseCollection.__init__(self)
		if 'passed_mongo' in kwargs:
			self.mongo = kwargs['passed_mongo']
			self.mongo_database = self.mongo[args[2]]
			if args[0] and args[1]:
				self.mongo_database.authenticate(args[0], args[1])
			self.mongo_collection = self.mongo_database[args[3]]
		else:
			self.mongo = pymongo.MongoClient(args[0], int(args[1]))
			self.mongo_database = self.mongo[args[4]]
			if args[2] and args[3]:
				self.mongo_database.authenticate(args[2], args[3])
			self.mongo_collection = self.mongo_database[args[5]]
示例#5
0
 def __init__(self,
              filepath,
              compression=None,
              encoding='utf-8',
              throw_error=1,
              mode='r',
              verbose=0):
     BaseCollection.__init__(self)
     self.filepath = filepath
     self.compression = compression
     self.encoding = encoding
     self.throw_error = throw_error
     self.verbose = verbose
     self.mode = mode
     if not os.path.isfile(filepath):
         raise IOError(
             filepath,
             'JsonCollection could not find your file, it\'s mispelled or doesn\'t exist.'
         )
示例#6
0
	def __init__(self, filepath):
		BaseCollection.__init__(self)
		self.filepath = filepath
		if not os.path.isfile(filepath):
			raise IOError(filepath, 'JsonCollection could not find your file, it\'s mispelled or doesn\'t exist.')