File: server6045.js

package info (click to toggle)
mongodb 1%3A2.4.10-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 82,464 kB
  • sloc: cpp: 740,225; ansic: 152,098; sh: 13,820; python: 11,864; makefile: 1,012; perl: 922; pascal: 617; java: 452; lisp: 222; asm: 174
file content (43 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* @file : jstests/aggregation/bugs/server6045.js
 *
 * SERVER 6045 : aggregate cmd crashes server with empty pipeline argument
 *
 * This test validates part of SERVER 6045 ticket. Return errmsg upon blank
 * document in pipeline. Previously blank documents in pipeline would cause
 * server to crash
 */

/*
 * 1) Grab aggdb
 * 2) Empty aggdb
 * 3) Populate aggdb
 * 4) Run aggregate with an empty document as the pipeline, at the start of the
 *    pipeline, at the end of the pipeline, and in the middle of the pipeline
 * 5) Assert that all four position return the expected error
 */

load('jstests/aggregation/extras/utils.js');

// Use aggdb
db = db.getSiblingDB('aggdb');

// Empty and fill aggdb
db.agg.drop();
db.agg.insert({key: "string", value: 17});
db.agg.insert({key: "yarn", value: 42});

// As pipeline
assertErrorCode(db.agg, [{}], 16435);
// Start of pipeline
assertErrorCode(db.agg, [{$project: {value: 1}}
                        ,{}
                        ], 16435);
// End of pipeline
assertErrorCode(db.agg, [{}
                        ,{$project: {value: 1}}
                        ], 16435);
// Middle of pipeline
assertErrorCode(db.agg, [{$project: {value: 1}}
                        ,{}
                        ,{$project: {value: 1}}
                        ], 16435);