Skip to content
This repository was archived by the owner on Feb 28, 2025. It is now read-only.

Various improvements #19

Merged
merged 7 commits into from
Dec 22, 2023
Merged

Various improvements #19

merged 7 commits into from
Dec 22, 2023

Conversation

alcaeus
Copy link
Member

@alcaeus alcaeus commented Dec 21, 2023

This PR adds a few improvements I've noticed while working on some pipelines:

  • $mergeObjects is also available as an expression operator. I've followed the same strategy we previously used for $first
  • The defaults argument for $zip should be optional
  • $add and $subtract only implemented ResolvesToNumber. This made them unsuitable for use in places where an integer was required (in my case the n argument to $slice). I've changed the operators to resolve to all numeric types individually. Note that the pipeline may error on the server if $add evaluates to a value of the wrong type, but we can't solve that without adding generics
  • The $expr query operator was marked as a fieldQuery when it is actually a query similar to $and and $or.

@alcaeus alcaeus requested a review from GromNaN December 21, 2023 15:48
Copy link
Member

@GromNaN GromNaN left a comment

Choose a reason for hiding this comment

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

It would be great to add tests on this operators to bury these changes.

@alcaeus alcaeus requested a review from GromNaN December 22, 2023 10:44
@alcaeus
Copy link
Member Author

alcaeus commented Dec 22, 2023

Fixed another issue with $zip (the useLongestLength argument should be optional) and added tests from the docs for all updated operators

Comment on lines +22 to +23
from: 'items', // field in the orders collection
localField: 'item', // field in the items collection
Copy link
Member

Choose a reason for hiding this comment

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

You even took the comments 👏🏻

@alcaeus alcaeus merged commit b0886f8 into mongodb:0.1 Dec 22, 2023
@alcaeus alcaeus deleted the various-improvements branch January 10, 2024 09:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants