Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 17e0ddf

Browse files
committed
add more mongodb indexes
1 parent 505d200 commit 17e0ddf

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

element/manager/mongo.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,38 @@ def __init__(self, client, database, collection, logger=None):
2626
"sparse": False,
2727
})
2828

29+
self.get_collection().ensure_index([("type", pymongo.ASCENDING)], 300, **{
30+
"name": "type",
31+
"unique": False,
32+
"background": False,
33+
"sparse": False,
34+
})
35+
2936
self.get_collection().ensure_index([("uuid", pymongo.ASCENDING)], 300, **{
3037
"name": "uuid",
3138
"unique": True,
3239
"background": False,
3340
"sparse": False,
3441
})
3542

43+
self.get_collection().ensure_index([("alias", pymongo.ASCENDING)], 300, **{
44+
"name": "uuid",
45+
"unique": False,
46+
"background": False,
47+
"sparse": False,
48+
})
49+
50+
self.get_collection().ensure_index([
51+
("type", pymongo.ASCENDING),
52+
("tag", pymongo.ASCENDING),
53+
("path", pymongo.ASCENDING),
54+
], 300, **{
55+
"name": "type",
56+
"unique": False,
57+
"background": False,
58+
"sparse": False,
59+
})
60+
3661
def get_collection(self):
3762
return self.client[self.database][self.collection]
3863

0 commit comments

Comments
 (0)