-
Notifications
You must be signed in to change notification settings - Fork 100
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
Aggregate builder stage .group #268
Comments
We used to have Group, but that operation is so incredibly varied and complicated that we couldn't get a good API for it. MongoKitten is currently designed with a couple of layers. The most obvious types contain the common and basic operations in a nice API, the Commands API contains anything less common you need to customise, without cluttering the main namespace. And finally you can drop down to raw MongoDB commands. For Aggregate stages that means that you've got helpers for creating common stages such as |
@NotesClef I had the same issue just now and defined the stage in a Document. var userGroup = Document()
userGroup["$group"]["_id"] = "null"
userGroup["$group"]["users"]["$sum"] = 1
var userProject = Document()
userProject["$project"]["_id"] = 0
let aggregateBuilderStages: [AggregateBuilderStage] = [
AggregateBuilderStage(document: userGroup),
AggregateBuilderStage(document: userProject)
] Note: Yes, sample above is the same as $count(field). |
Post on Medium from 2017, as well as comments here on GitHub, indicate that there should be .group available as an aggregate builder stage?
With latest build of MongoKitten, I am receiving an error stating that AggregateBuilderStage has no member of "group" (as per example below):
Is group supported currently for aggregate stages, and if so could you please let me know the correct syntax?
Thank you for your help!
The text was updated successfully, but these errors were encountered: