mongos> sh.enableSharding("test");
|
{
|
"ok" : 1,
|
"$clusterTime" : {
|
"clusterTime" : Timestamp(1636120119, 2),
|
"signature" : {
|
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
|
"keyId" : NumberLong(0)
|
}
|
},
|
"operationTime" : Timestamp(1636120119, 1)
|
}
|
mongos> sh.shardCollection("test.test", {_id: "hashed"});
|
{
|
"collectionsharded" : "test.test",
|
"ok" : 1,
|
"$clusterTime" : {
|
"clusterTime" : Timestamp(1636120139, 33),
|
"signature" : {
|
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
|
"keyId" : NumberLong(0)
|
}
|
},
|
"operationTime" : Timestamp(1636120139, 27)
|
}
|
mongos> for (var j = 0 ; j < 100; ++j) {db.test.insert({x: j});}
|
WriteResult({ "nInserted" : 1 })
|
mongos> db.createView("view", "test", [{$addFields: {y: 1}}]);
|
{
|
"ok" : 1,
|
"$clusterTime" : {
|
"clusterTime" : Timestamp(1636120216, 2),
|
"signature" : {
|
"hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="),
|
"keyId" : NumberLong(0)
|
}
|
},
|
"operationTime" : Timestamp(1636120216, 2)
|
}
|
mongos> db.test.aggregate({$collStats: {}});
|
{ "ns" : "test.test", "shard" : "__unknown_name__-rs0", "host" : "james:20000", "localTime" : ISODate("2021-11-05T13:50:34.925Z") }
|
{ "ns" : "test.test", "shard" : "__unknown_name__-rs1", "host" : "james:20001", "localTime" : ISODate("2021-11-05T13:50:34.925Z") }
|
mongos> db.view.aggregate({$collStats: {}});
|
{ "ns" : "test.view", "shard" : "__unknown_name__-rs1", "host" : "james:20001", "localTime" : ISODate("2021-11-05T13:50:41.308Z") }
|
mongos>
|