-
Type:
Bug
-
Resolution: Fixed
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
Fully Compatible
-
ALL
-
v6.0
-
Execution Team 2022-10-31
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Instead, we receive a "X is a view, not a collection" error whereas we expected to see "Collection UUID does not match that specified":
rs:PRIMARY> db.k.insert({a: 1})
WriteResult({ "nInserted" : 1 })
rs:PRIMARY> db.createView("myview1", "k", [])
{
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1666040411, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1666040411, 1)
}
rs:PRIMARY> db.getCollectionInfos()
[
{
"name" : "k",
"type" : "collection",
"options" : {
},
"info" : {
"readOnly" : false,
"uuid" : UUID("57f2edab-d2a8-4a16-9362-5df638eb05c5")
},
"idIndex" : {
"v" : 2,
"key" : {
"_id" : 1
},
"name" : "_id_"
}
},
{
"name" : "myview1",
"type" : "view",
"options" : {
"viewOn" : "k",
"pipeline" : [ ]
},
"info" : {
"readOnly" : true
}
},
{
"name" : "system.views",
"type" : "collection",
"options" : {
},
"info" : {
"readOnly" : false,
"uuid" : UUID("56cf39fe-8489-4c86-87f0-b027c16b5fc0")
},
"idIndex" : {
"v" : 2,
"key" : {
"_id" : 1
},
"name" : "_id_"
}
}
]
rs:PRIMARY> db.runCommand({insert: "myview1", documents: [{a: 2}, {a: 3}], collectionUUID: UUID("57f2edab-d2a8-4a16-9362-5df638eb05c5")})
{
"n" : 0,
"electionId" : ObjectId("7fffffff0000000000000001"),
"opTime" : {
"ts" : Timestamp(1666040411, 1),
"t" : NumberLong(1)
},
"writeErrors" : [
{
"index" : 0,
"code" : 166,
"errmsg" : "Namespace b.myview1 is a view, not a collection"
}
],
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1666040411, 1),
"signature" : {
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
"keyId" : NumberLong(0)
}
},
"operationTime" : Timestamp(1666040411, 1)
}
- related to
-
SERVER-68337 Perform collectionUUID check inside of AutoGetCollection
-
- Closed
-