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

Implement addField for Aggregate #42

Merged
merged 2 commits into from
Jun 23, 2024

Conversation

lenguyenthanh
Copy link
Contributor

@lenguyenthanh lenguyenthanh commented Jun 23, 2024

close #40

Couldn't help my self to implement it before your answer, as I need to use this in our project.

p/s: It works in my machine

* the value of the new field
* @return
* the \$addFields pipeline stage [[https://www.mongodb.com/docs/manual/reference/operator/aggregation/addFields/]]
* @since 3.4
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Kirill5k
Copy link
Owner

Kirill5k commented Jun 23, 2024

Looks good, however could you please change the name of the method from addFields to addField, since you are only adding a single field in there?

Or maybe change the implementation to allow adding multiple fields at once?

@Kirill5k
Copy link
Owner

Looking good. thank you very much 👍
I'll release it today

@Kirill5k Kirill5k merged commit 1b42a95 into Kirill5k:master Jun 23, 2024
3 checks passed
@lenguyenthanh
Copy link
Contributor Author

I updated so now We have two versions of addFields similar to facet which allow varargs or List as arguments.

oops you merged it when I'm writing this comment. Thanks!

@lenguyenthanh lenguyenthanh deleted the aggregate-add-fields branch June 23, 2024 14:03
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.

How to use $addFields aggregation
2 participants