From 217133137bc353b5d9950d2db186e3592f0e3ae1 Mon Sep 17 00:00:00 2001 From: Stefan Zermatten Date: Thu, 29 Apr 2021 11:34:58 +0200 Subject: [PATCH] Added note to improve query performance with root ancestor targeting --- app/imports/api/parenting/ChildSchema.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/imports/api/parenting/ChildSchema.js b/app/imports/api/parenting/ChildSchema.js index e5dac848..98bc4ae9 100644 --- a/app/imports/api/parenting/ChildSchema.js +++ b/app/imports/api/parenting/ChildSchema.js @@ -4,6 +4,11 @@ const RefSchema = new SimpleSchema({ id: { type: String, regEx: SimpleSchema.RegEx.Id, + // TODO: Rather than indexing this field, index `ancestors.0.id` to only + // index the root of the ancestor heirarchy to significantly reduce + // index size and improve performance + // All queries on an ancestor document need to target `ancestors.0.id` first + // before targeting a younger ancestor index: 1 }, collection: {