Last active
July 31, 2020 23:12
-
-
Save kommradHomer/ce3c12b3466187cd973feb4d96678506 to your computer and use it in GitHub Desktop.
bucket-with-options
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BucketOptions o=new BucketOptions(); | |
o.output( | |
new BsonField("student_ids", new Document("$push","$student_id")), | |
new BsonField("attended_class",new Document("$sum", | |
new Document("$cond", | |
Arrays.asList( | |
new Document("$gte",Arrays.asList("$attn",8)), | |
1, | |
0 | |
) | |
) | |
) | |
), | |
new BsonField("students_total", new Document("$sum",1)) | |
); | |
Bson b=Aggregates.bucket("$final_grade", Arrays.asList(0,45,55,70,85,100),o); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment