|
@@ -97,7 +97,7 @@ class MongodbHandler:
|
|
|
'''
|
|
|
self._database[collection_name].drop()
|
|
|
|
|
|
- def create_index(self, collection_name: str, key: str, direction: str='text'):
|
|
|
+ def create_index(self, collection_name: str, key: str, direction: (str, int)='text'):
|
|
|
'''
|
|
|
:param str collection_name: name on the collection for which the schema will be set.
|
|
|
:param str key: Which value should be used as the index.
|
|
@@ -108,8 +108,8 @@ class MongodbHandler:
|
|
|
|
|
|
assert(isinstance(collection_name, str)),\
|
|
|
"Parameter 'collection_name' must be a string type"
|
|
|
- assert(isinstance(key, str) and key in allowed_directions),\
|
|
|
- "Parameter 'key' must be a string type and must be one of these values: 1, -1, '2d', 'geoHaystack', '2dsphere', 'hashed', 'text' "
|
|
|
+ assert(isinstance(key, (str, int)) & key in allowed_directions),\
|
|
|
+ "Parameter 'key' must be a string or integer type and must be one of these values: 1, -1, '2d', 'geoHaystack', '2dsphere', 'hashed', 'text' "
|
|
|
assert(isinstance(direction, str)),\
|
|
|
"Parameter 'direction' must be a string type"
|
|
|
|