Hi, just curious why there is no helpers in the driver to avoid having to write something as verbose as new Document("$eq", List.of("$field", "$$var"))
in aggregation pipelines?
Hi! Would you mind having a look at https://jira.mongodb.org/browse/JAVA-3879 and letting me know if this meets your needs? It was included in the most recent release of the Java Driver, 4.9, released February 10, 2023.
Not sure, I couldn’t find documentation/exemples to properly understand the changes.
Appreciate the feedback. Docs are forthcoming, I’ll update this thread once they are live. Thanks!
A silimar case is when using Aggregates.set, AFAIK there no helper for $first so you end up with something like:
pipeline.add(set(new Field<>("myfield", new Document("$first", "$myarray"))));
I believe docs are now available for the feature I linked above, Builders for Aggregation Expressions.
Would you mind taking a look at https://www.mongodb.com/docs/drivers/java/sync/v4.9/fundamentals/builders/aggregates/?
The only thing new in 4.9 related to aggregation helpers seems to be this one:
Added support for the $documents aggregation pipeline stage
to the Aggregates helper class.
Apologies, docs are still being updated to reflect individual aggregation expression operators that are available now in 4.9. For information on comparison operators specifically, this PR is a good entry point. I’ll update this thread once the docs are complete for all the aggregation expression operators that were added in 4.9.