Legacy insert does not:
> use newdb switched to db newdb > db.dropDatabase() { "dropped" : "newdb", "ok" : 1 } > db.stats() { "db" : "newdb", "collections" : 0, "objects" : 0, "avgObjSize" : 0, "dataSize" : 0, "storageSize" : 0, "numExtents" : 0, "indexes" : 0, "indexSize" : 0, "fileSize" : 0, "dataFileVersion" : { }, "ok" : 1 } > db.getMongo().insert('newdb.foo', {$notAllowed: true}, 0); > db.stats() { "db" : "newdb", "collections" : 0, "objects" : 0, "avgObjSize" : 0, "dataSize" : 0, "storageSize" : 0, "numExtents" : 0, "indexes" : 0, "indexSize" : 0, "fileSize" : 0, "dataFileVersion" : { }, "ok" : 1 } > db.foo.runCommand('insert', {documents: [{$notAllowed: true}]}) { "ok" : 1, "n" : 0, "writeErrors" : [ { "index" : 0, "code" : 2, "errmsg" : "Document can't have $ prefixed field names: $notAllowed" } ] } > db.stats() { "db" : "newdb", "collections" : 3, "objects" : 4, "avgObjSize" : 64, "dataSize" : 256, "storageSize" : 24576, "numExtents" : 3, "indexes" : 1, "indexSize" : 8176, "fileSize" : 67108864, "nsSizeMB" : 16, "dataFileVersion" : { "major" : 4, "minor" : 5 }, "extentFreeList" : { "num" : 0, "totalSize" : 0 }, "ok" : 1 } > db.foo.stats() { "ns" : "newdb.foo", "count" : 0, "size" : 0, "storageSize" : 8192, "numExtents" : 1, "nindexes" : 1, "lastExtentSize" : 8192, "paddingFactor" : 1, "systemFlags" : 1, "userFlags" : 1, "totalIndexSize" : 8176, "indexSizes" : { "_id_" : 8176 }, "ok" : 1 }
- is related to
-
SERVER-12994 Invalid queries accepted by delete command for collection that doesn't exist
- Closed
- related to
-
SERVER-66964 remove insert2.js
- Closed