summaryrefslogtreecommitdiff
path: root/jstests/core/index_create_with_nul_in_name.js
blob: 8c8fe14f0fae20ed24feb59e2a3f6284fd3f04c0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
// SERVER-16672 disallow creating indexes with NUL bytes in the name

(function() {
'use strict';

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

const idx = {
    key: {'a': 1},
    name: 'foo\0bar'
};
assert.commandFailedWithCode(coll.runCommand('createIndexes', {indexes: [idx]}),
                             ErrorCodes.CannotCreateIndex);
}());