We’re trying to add a index as follows on a field which won’t always have data:
db.customers.createIndex({ eligibilityId: 1 }, { partialFilterExpression: { eligibilityId: { $exists: true } } });
to a collection in a M50 cluster with 500K documents.
When running the script to perform this index created we get the following error and we’re not sure how to resolve it:
Error: command failed: {
"operationTime" : Timestamp(1636570102, 1),
"ok" : 0,
"errmsg" : "Exceeded memory limit for $group, but didn't allow external sort. Pass allowDiskUse:true to opt in.",
"code" : 16945,
"codeName" : "Location16945",
"$clusterTime" : {
"clusterTime" : Timestamp(1636570102, 1),
"signature" : {
"hash" : BinData(0,"2Ud1T0j/gGO9a3WGk9FbUjeZG38="),
"keyId" : NumberLong("6983333742001520642")
}
}