imbo / imbo-mongodb-adapters

MongoDB storage and database adapters for Imbo
MIT License
0 stars 0 forks source link

Indexing mongodb #1

Open chrisaq opened 8 years ago

chrisaq commented 8 years ago

Indexes I've added so far, but might be useful to put in a post install script or similar:

image collection

db.image.ensureIndex({"publicKey": 1, "imageIdentifier": 1}, { background: true }) db.image.ensureIndex({"publicKey": 1, "updated": -1}, { background: true }) db.image.ensureIndex({"publicKey": 1, "added": -1}, { background: true }) db.image.ensureIndex({"user": 1, "imageIdentifier": 1}, { background: true }) db.image.ensureIndex({"user": 1, "added": -1}, { background: true }) db.image.ensureIndex({"user": 1, "updated": -1}, { background: true })

imagevariation collection

db.imagevariation.ensureIndex({"user": 1, "imageIdentifier": 1}, { background: true }) db.imagevariation.ensureIndex({"user": 1, "imageIdentifier": 1, "width": 1}, { background: true })

chrisaq commented 8 years ago

As suggested I removed these indexes: db.image.ensureIndex({"publicKey": 1, "imageIdentifier": 1}, { background: true }) db.image.ensureIndex({"publicKey": 1, "updated": -1}, { background: true }) db.image.ensureIndex({"publicKey": 1, "added": -1}, { background: true })

It worked out fine.

christeredvartsen commented 8 years ago

This should be provided as scripts that comes with Imbo that can create the indexes, and mentioned in the docs as well.