DATAMONGO-1549 - Polishing $count (aggregation stage).

Original Pull Request: #422
This commit is contained in:
Christoph Strobl
2016-12-12 09:27:45 +01:00
parent cab35759db
commit 4e56d9c575
2 changed files with 8 additions and 11 deletions

View File

@@ -22,12 +22,12 @@ import com.mongodb.BasicDBObject;
import com.mongodb.DBObject;
/**
* Encapsulates the aggregation framework {@code $count}-operation.
* <p>
* We recommend to use the static factory method {@link Aggregation#count()} instead of creating instances of this
* class directly.
*
* @see https://docs.mongodb.com/manual/reference/operator/aggregation/count/#pipe._S_count
* Encapsulates the aggregation framework {@code $count}-operation. <br />
* We recommend to use the static factory method {@link Aggregation#count()} instead of creating instances of this class
* directly.
*
* @see <a href=
* "https://docs.mongodb.com/manual/reference/operator/aggregation/count/#pipe._S_count">https://docs.mongodb.com/manual/reference/operator/aggregation/count/</a>
* @author Mark Paluch
* @since 1.10
*/

View File

@@ -20,12 +20,11 @@ import static org.junit.Assert.*;
import org.junit.Test;
import com.mongodb.DBObject;
import com.mongodb.util.JSON;
/**
* Unit tests for {@link CountOperation}.
*
*
* @author Mark Paluch
*/
public class CountOperationUnitTests {
@@ -45,9 +44,7 @@ public class CountOperationUnitTests {
public void shouldRenderCorrectly() {
CountOperation countOperation = new CountOperation("field");
DBObject dbObject = countOperation.toDBObject(Aggregation.DEFAULT_CONTEXT);
assertThat(dbObject, is(JSON.parse("{$count : \"field\" }")));
assertThat(countOperation.toDBObject(Aggregation.DEFAULT_CONTEXT), is(JSON.parse("{$count : \"field\" }")));
}
/**