INNER CODE UNIT · Go
TestPagingQuery_Aggregate
gobeam/mongo-go-pagination · pagingQuery_test.go:171
func TestPagingQuery_Aggregate(t *testing.T) {
_, session := NewConnection()
db := session.Database(DatabaseName)
collection := db.Collection(DatabaseCollection)
defer cleanup(db)
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
insertedIds, err := insertExamples(db)
if len(insertedIds) < 1 {
t.Errorf("Empty insert ids")
}
if err != nil {
t.Errorf("Data insert error. Error: %s", err.Error())
}
// getting page 2 data
var limit int64 = 10
var page int64
// Aggregate pipeline pagination test