I understand it's an issue with my projection but I don't fully understand what I'm doing wrong as this worked until a recent MongoDB upgrade.
I am using Mongoose and Node.JS.
await UserModel.findOne({ username: 'test' }).sort({ createdOn: 1 }).select('username authorization.type authorization.homepage').exec();
My User has an Authorization subdocument inside of it with fields _id, type, createdOn, and homepage.
I'm not sure what exactly is wrong with what I am trying to do, any ideas?
I do have a pre find hook that will populate the reference fields in a schema for a model.
I wonder if that has something to do with it.
question from:
https://stackoverflow.com/questions/65937166/path-collision-error-mongoose-select-subdocument-fields 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…