Commit 77005b85 authored by bow's avatar bow
Browse files

Add database unique index on API user IDs

parent e90469c8
......@@ -32,6 +32,13 @@ var missingIndex = function(existingIndices, expectedIndex) {
});
};
// users -> index by id + unique
var userIndex = {"id": 1};
if (missingIndex(db.users.getIndexes(), userIndex)) {
db.users.createIndex(userIndex, {"unique": true});
print("index created: users");
}
// fs.files -> index by md5 and metadata.uploaderId + unique
var fileIndex = {"md5": 1, "metadata.uploaderId": 1};
if (missingIndex(db.fs.files.getIndexes(), fileIndex)) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment