Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
525 views
in Technique[技术] by (71.8m points)

node.js - Path Collision Error Mongoose Select Subdocument Fields

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...