fix(mongodb): return all stored fields from search for CF/PG parity (+ README parity)#63
Merged
Merged
Conversation
Mongo search projected only the reserved fields plus filterableFields, so
stored extension fields that weren't marked filterable were silently dropped
from results — diverging from findByIds (which returns all non-reserved
fields) and from the CF/PG adapters (whose search returns all stored fields).
Fetch all fields except the embedding vector ($addFields score + $project
{ embedding: 0 }) and map every non-reserved field. The heavy embedding stays
excluded, so only the small extension fields that were missing now round-trip.
Adds a spec asserting a non-filterable stored field is returned by search.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings MongoDB to parity with the PG/CF adapters: a real
searchbehavior fix, plus the contract README cleanup.Code:
searchnow returns all stored fields (CF/PG parity)Mongo
searchprojected only the reserved fields plusfilterableFields, silently dropping stored extension fields that weren't marked filterable — diverging fromfindByIds(which returns all non-reserved fields) and from the CF/PG adapters, whosesearchreturns all stored fields. Now fetches all fields except theembeddingvector ($addFieldsscore +$project: { embedding: 0 }) and maps every non-reserved field. The heavy vector stays excluded, so only the small extension fields that were missing now round-trip. Resolves the review finding thatfindByIdsandsearchreturned different field sets for the same record.search.Docs: adapters/README parity cleanup
wherefull;likeregex ✅; no migration bin — runtimeensureSearchIndex; score range =vectorSearchScore).vectorSearchWhere.spec.ts, but CF'swherecoverage lives inwhere.spec.ts(59 tests). Now stated accurately per-adapter.Based on
main(latest merged in: #61 cf-workers-types, #64/#65 defer-validation, #66 version-packages).