feat(mongodb): implement object-based select projection for find methods#12237
feat(mongodb): implement object-based select projection for find methods#12237pkuczynski wants to merge 4 commits intomasterfrom
Conversation
Review Summary by QodoImplement MongoDB object-based select projection for find methods
WalkthroughsDescription• Implement object-based select projection for MongoDB find methods • Convert nested select objects to dot-path MongoDB projections • Add comprehensive test suite with proper field assertions • Move tests from github-issues to functional test directory Diagramflowchart LR
A["FindOptionsSelect object<br/>e.g. {profile: {name: true}}"] -- "convertFindOptionsSelectToProjectCriteria" --> B["MongoDB projection<br/>e.g. {profile.name: 1}"]
B -- "Applied to find queries" --> C["Results with only<br/>selected fields"]
File Changes1. src/entity-manager/MongoEntityManager.ts
|
commit: |
Code Review by Qodo
1. ObjectId projection mismatch
|
themavik
left a comment
There was a problem hiding this comment.
Reviewed the changes — the approach looks correct and addresses the reported issue.
…ojection # Conflicts: # src/entity-manager/MongoEntityManager.ts
Deploying typeorm with
|
| Latest commit: |
b0f8e0b
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://f5365604.typeorm.pages.dev |
| Branch Preview URL: | https://fix-mongo-select-projection.typeorm.pages.dev |
|



Implement
convertFindOptionsSelectToProjectCriteriato convertFindOptionsSelectobject syntax into MongoDB projection documents with dot-path flattening for nested fields (e.g.{ profile: { name: true } }→{ "profile.name": 1 }).Previously, the object-based
selectoption was silently ignored for MongoDB (// todo: implement), causing all fields to be returned regardless of theselectspecified.test/github-issues/1929/totest/functional/mongodb/basic/select-projection/and add proper assertions verifying non-selected fields are absent from results