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

Fix $map query transform, add tests for $map and $explain #154

Merged
merged 3 commits into from
Feb 13, 2024

Conversation

ericyhwang
Copy link
Contributor

While adding tests for $map and $explain in queries in #152, I found out that $map doesn't actually work. It just hangs since the cursor is never traversed for results.

This fixes $map by adding a toArray(). The results are delivered in the extra callback parameter, since the mapping function could map to something that's not a Mongo document, which would violate sharedb's assumptions around results being an array of Mongo docs.

I also added a test for $explain.

sharedb-mongo includes and runs all tests from sharedb core, and one of the core tests requires rich-text to be installed.
@coveralls
Copy link

Coverage Status

coverage: 92.574% (+0.5%) from 92.079%
when pulling 220dfbf on fix-map-add-tests
into 0ca1235 on master.

@ericyhwang ericyhwang merged commit 5e6fc4c into master Feb 13, 2024
32 checks passed
@ericyhwang ericyhwang deleted the fix-map-add-tests branch February 13, 2024 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants