Is your feature request related to a problem?
Following the decision to remove _id (a MongoDB ObjectID) on post and media data and index on properties.uid, we added the following:
|
// `_id` came indexed; `properties.uid` does not. Every paginated query |
|
// sorts and ranges on it, and MongoDB abandons an unindexed sort once it |
|
// needs more than 32MB, so a large enough collection would stop listing |
|
// at all. Creating an index that already exists is a no-op. |
|
for (const name of ["posts", "media"]) { |
|
const collection = this.collections.get(name); |
|
if (collection) { |
|
await collection.createIndex({ "properties.uid": 1 }); |
|
debug(`Indexed ‘properties.uid’ on ‘${name}’`); |
|
} |
|
} |
We may need to add an indexable property for the Microsub endpoint too (see #944).
The indexable property should be declared using the addCollection method and via the respective plugins, rather than something that is hardcoded into the core package.
Describe the solution you’d like
Add an optional second parameter to addCollection, which is the property to index items on:
new Indiekit.addCollection(name, "properties.uid");
Is your feature request related to a problem?
Following the decision to remove
_id(a MongoDB ObjectID) on post and media data and index onproperties.uid, we added the following:indiekit/packages/indiekit/index.js
Lines 214 to 224 in 0047ea8
We may need to add an indexable property for the Microsub endpoint too (see #944).
The indexable property should be declared using the
addCollectionmethod and via the respective plugins, rather than something that is hardcoded into the core package.Describe the solution you’d like
Add an optional second parameter to
addCollection, which is the property to index items on: