Details
-
Bug
-
Resolution: Unresolved
-
Major - P3
-
None
-
None
-
None
-
Mongo 4.4
-
Query Execution
-
ALL
-
Query 2020-11-30, Query 2020-12-14, Query 2020-12-28, Query 2021-01-11, Query 2021-01-25, Query Execution 2021-02-22, Query Execution 2021-03-08, Query Execution 2021-03-22, Query Execution 2021-04-05, Query Execution 2021-04-19, Query Execution 2021-05-03, Query Execution 2021-05-17, Query Execution 2021-05-31, Query Execution 2021-06-14, Query Execution 2021-06-28, Query Execution 2021-07-12, Query Execution 2021-07-26, QE 2021-08-09, QE 2023-08-21, QE 2023-09-04, QE 2023-09-18, QE 2023-10-02, QE 2023-10-16, QE 2023-10-30
Description
In Mongo 4.4, shard keys can be missing, see https://docs.mongodb.com/manual/core/sharding-shard-key/#shard-key-missing
This works fine for insert of documents, however merge in aggregation-framework is failing:
db = db.getSiblingDB("mip") |
db.createCollection("sharded_col") |
sh.enableSharding("mip") |
sh.shardCollection("mip.sharded_col", { tsi: 1 }) |
|
|
db.sharded_col.insertOne({ a: 1 }) |
|
|
db.sharded_col.aggregate([
|
{ $set: { a: 2 } }, |
{ $unset: "_id" }, |
{ $merge: { into: "sharded_col" } } |
])
|
|
|
{
|
"ok" : 0.0, |
"errmsg" : "$merge write error: 'on' field 'tsi' cannot be missing, null, undefined or an array", |
"code" : NumberInt(51132), |
"codeName" : "Location51132", |
"operationTime" : Timestamp(1601372348, 4), |
"$clusterTime" : { |
"clusterTime" : Timestamp(1601372351, 40), |
"signature" : { |
"hash" : BinData(0, "wv5eJ/xcJoaS1m14aJeoSA3WSqo="), |
"keyId" : NumberLong(6854861305854033921) |
}
|
}
|
}
|
|
If MongoDB permits missing shard key then it should also apply for merge.