Skip to content

Node.js based forum software built for the modern web

490 B
Raw Blame
'use strict';


const db = module.parent.require('./database');

module.exports = {
	name: 'Add a partial index on set members',
	timestamp: Date.UTC(2026, 2, 11),
	method: async function () {
		const nconf = require('nconf');
		const isMongo = nconf.get('database') === 'mongo';
		if (!isMongo) {
			return;
		}

		await db.client.collection('objects').createIndex(
			{ members: 1, _key: 1 },
			{ background: true, partialFilterExpression: { members: { $exists: true } } },
		);
	},
};