Commentaire d’issue · Issue #979 Add index property to addCollection method · @rmdes
Yes, and I’d make the second parameter the index specs rather than one property, because Microsub’s indexes are compound and two are unique:
Indiekit.addCollection(“microsub_items”, [ { key: { channel: 1, id: 1 }, unique: true }, { key: { channel: 1, uid: 1 }, unique: true }, { key: { channel: 1, url: 1 } }, ]);
Core creates them when the database is up, posts and media declare { key: { "properties.uid": 1 } } from their own plugins, and the literal list in index.js goes. The uid backfill stays in core, since it writes a properties subdocument and must not touch other collections.
Happy to do it as its own PR, and move #944’s createIndexes onto it once it lands.