Show
> db.runCommand({ "create" : "collectionName" , "validator" : { "fieldName" : { "$gte" : 1024 }}})
{ "ok" : 1 }
> db.runCommand({ "create" : "outCollectionName" , "validator" : { "fieldName" : { "$gte" : 8192 }}})
{ "ok" : 1 }
> db.runCommand({insert: "collectionName" , "documents" : [{ "fieldName" : 128}]})
{
"ok" : 1,
"n" : 0,
"writeErrors" : [
{
"index" : 0,
"code" : 121,
"errmsg" : "Document failed validation"
}
]
}
> db.runCommand({insert: "collectionName" , "documents" : [{ "fieldName" : 2048}]})
{ "ok" : 1, "n" : 1 }
> db.runCommand({ "aggregate" : "collectionName" , pipeline: [ { "$out" : "outCollectionName" } ]})
{
"ok" : 0,
"errmsg" : "insert for $out failed: { connectionId: 1, err: \"Document failed validation\", code: 121, n: 0, ok: 1.0 }" ,
"code" : 16996
}
> db.version()
3.1.9-pre-
> db.runCommand({buildinfo: 1})
{
"version" : "3.1.9-pre-" ,
"gitVersion" : "849505ebc395d15c6f777d96436447f1f98f7285" ,
"modules" : [
"enterprise"
],
"allocator" : "tcmalloc" ,
"javascriptEngine" : "mozjs" ,
"sysInfo" : "deprecated" ,
"versionArray" : [
3,
1,
9,
-100
],
"openssl" : {
"running" : "OpenSSL 1.0.1f 6 Jan 2014" ,
"compiled" : "OpenSSL 1.0.1f 6 Jan 2014"
},
"buildEnvironment" : {
"distmod" : "ubuntu1404" ,
"distarch" : "x86_64" ,
"cc" : "/opt/mongodbtoolchain/bin/gcc: gcc (GCC) 4.8.2" ,
"ccflags" : "-fno-omit-frame-pointer -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -O2 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-missing-braces -fno-builtin-memcmp" ,
"cxx" : "/opt/mongodbtoolchain/bin/g++: g++ (GCC) 4.8.2" ,
"cxxflags" : "-Wnon-virtual-dtor -Woverloaded-virtual -std=c++11" ,
"linkflags" : "-fPIC -pthread -Wl,-z,now -rdynamic -fuse-ld=gold -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,-E" ,
"target_arch" : "x86_64" ,
"target_os" : "linux"
},
"bits" : 64,
"debug" : false ,
"maxBsonObjectSize" : 16777216,
"storageEngines" : [
"devnull" ,
"inMemoryExperiment" ,
"mmapv1" ,
"wiredTiger"
],
"ok" : 1
}