summaryrefslogtreecommitdiff
path: root/jstests/aggregation/bugs/server14670.js
blob: adadb154da0309468ed17e61dc5d65b12bfc9d0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// SERVER-14670 introduced the $strLenBytes and $strLenCP aggregation expressions. In this file, we
// test the error cases for these expressions.
load("jstests/aggregation/extras/utils.js");  // For assertErrorCode.

(function() {
"use strict";

var coll = db.substr;
coll.drop();

// Need an empty document for the pipeline.
coll.insert({});

assertErrorCode(coll,
                [{$project: {strLen: {$strLenBytes: 1}}}],
                34473,
                "$strLenBytes requires a string argument.");

assertErrorCode(
    coll, [{$project: {strLen: {$strLenCP: 1}}}], 34471, "$strLenCP requires a string argument.");
}());