Show
In single mongod instance:
> db.test.insertMany([{ "nm" : "case" }, { "nm" : "CaSe" }, { "nm" : "câse" }])
{
"acknowledged" : true ,
"insertedIds" : [
ObjectId( "59b7887b90afeae466d0cdcb" ),
ObjectId( "59b7887b90afeae466d0cdcc" ),
ObjectId( "59b7887b90afeae466d0cdcd" )
]
}
> db.createView( "view" , "test" , [{$match: { "nm" : "case" }}], { "collation" : { "locale" : "en" , strength: 1}})
{ "ok" : 1 }
> db.view.find()
{ "_id" : ObjectId( "59b7887b90afeae466d0cdcb" ), "nm" : "case" }
{ "_id" : ObjectId( "59b7887b90afeae466d0cdcc" ), "nm" : "CaSe" }
{ "_id" : ObjectId( "59b7887b90afeae466d0cdcd" ), "nm" : "câse" }
In sharded cluster (2 shards, 3 config server started as replicaSet). Collection is not sharded
Cluster info :
mongos> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1 ,
"minCompatibleVersion" : 5 ,
"currentVersion" : 6 ,
"clusterId" : ObjectId( "59b7860fbc018363095e4c79" )
}
shards:
{ "_id" : "shard0000" , "host" : "localhost:27021" , "state" : 1 }
{ "_id" : "shard0001" , "host" : "localhost:27022" , "state" : 1 }
active mongoses:
"3.4.9" : 1
autosplit:
Currently enabled: yes
balancer:
Currently enabled: yes
Currently running: no
Balancer lock taken at Tue Sep 12 2017 11 : 00 : 35 GMT+ 0400 (RET) by ConfigServer:Balancer
Failed balancer rounds in last 5 attempts: 0
Migration Results for the last 24 hours:
No recent migrations
databases:
{ "_id" : "test" , "primary" : "shard0000" , "partitioned" : false }
mongos> db.test.insertMany([{ "nm" : "case" }, { "nm" : "CaSe" }, { "nm" : "câse" }])
{
"acknowledged" : true ,
"insertedIds" : [
ObjectId( "59b7890412b88ce4ce4ccf30" ),
ObjectId( "59b7890412b88ce4ce4ccf31" ),
ObjectId( "59b7890412b88ce4ce4ccf32" )
]
}
mongos> db.createView( "view" , "test" , [{$match: { "nm" : "case" }}], { "collation" : { "locale" : "en" , strength: 1}})
{ "ok" : 1 }
mongos> db.view.find()
{ "_id" : ObjectId( "59b7890412b88ce4ce4ccf30" ), "nm" : "case" }