Throw exception is in GroupBuilder if targetField value already set

Issue #4 new
created an issue

The design of GroupBuilder suggests that there should only exist a single call after put that would set the value for the specified field. If caller did something like put("blah").avg().first() this should report an error.

In addOperand check that there does not already exist an entry in the DBObject for the targetField key.

Comments (1)

  1. David M. Carr repo owner

    You're correct that the intent is that each call to put is followed by one operand call. I'll add a simple check to verify this. This could be enforced at compile time by having two return types from the builder, if someone feels motivation to provide an implementation.

  2. Log in to comment