Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongodb[patch]: Fix bug in mongodb storage.ts #6361

Merged
merged 2 commits into from
Aug 3, 2024

Conversation

drewB
Copy link
Contributor

@drewB drewB commented Aug 3, 2024

When retrieving records from MongoDBStore the value was always JSON.stringified even if the value was already in JSON. As a result, MongoDBStore does not work with standard retrievers like the ParentRetriever as it would always return documents with undefined for pageContent. This corrects that behavior by look at the value and only JSON.stringify if it is an Object. If it is a string then it just returns the value as is.

When retrieving records the value was always JSON.stringified even if the value was already in JSON.  As a result, MongoStore could not be used with standard retrievers like the ParentRetriever as it would always return documents with undefined for pageContent.
@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 3, 2024
Copy link

vercel bot commented Aug 3, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchainjs-api-refs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 3, 2024 1:20am
langchainjs-docs ✅ Ready (Inspect) Visit Preview Aug 3, 2024 1:20am

@dosubot dosubot bot added the auto:bug Related to a bug, vulnerability, unexpected error with an existing feature label Aug 3, 2024
@jacoblee93 jacoblee93 changed the title Fix bug in mongodb storage.ts mongodb[patch]: Fix bug in mongodb storage.ts Aug 3, 2024
Copy link
Collaborator

@jacoblee93 jacoblee93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems reasonable, thanks!

@dosubot dosubot bot added the lgtm PRs that are ready to be merged as-is label Aug 3, 2024
@jacoblee93
Copy link
Collaborator

Thanks! Cutting a new patch release now!

@jacoblee93
Copy link
Collaborator

Live here: https://www.npmjs.com/package/@langchain/mongodb

Thanks again!

@drewB
Copy link
Contributor Author

drewB commented Aug 12, 2024

Your welcome. Thanks for the fast merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto:bug Related to a bug, vulnerability, unexpected error with an existing feature lgtm PRs that are ready to be merged as-is size:XS This PR changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants