Invalid $addFields :: caused by :: undefined variable: setNumberPart
I’ve been developing an app to track my trading card collection. I’m attempting to use an aggregate pipeline for sorting cards at the database level since this app will contain a ton of data. I’m very new to aggregates, and I keep running into the issue where my setNumberPart variable is out of scope when referenced and I can’t seem to figure out a way to be within scope. Here is my pipeline code: