manual test logged directly to shard.
> db.listing_fields209_763293.getIndexes();
[
{
"v" : 1,
"key" :
{
"_id" : 1
}
,
"ns" : "homes_didx.listing_fields209_763293",
"name" : "id"
},
{
"v" : 1,
"key" :
{
"hash_fk_id" : NumberLong(1),
"fk_listing_id" : NumberLong(1)
}
,
"unique" : true,
"ns" : "homes_didx.listing_fields209_763293",
"name" : "hash_fk_id_1_fk_listing_id_1"
}
]
> db.listing_fields209_763293.find().min(
{hash_fk_id: "753af0f2"}
).max(
{hash_fk_ id: MaxKey}
);
error: {
"$err" : "no index found for specified keyPattern: {} min:
{ hash_fk_id: \"753af0f2\" }
max:
{ hash_fk_id: MaxKey }
",
"code" : 10367
executed on router..
mongos> db.listing_fields209_763293.ensureIndex(
{hash_fk_id:1}
);
db.listing_fields209_763293.find().min(
{hash_fk_id: "753af0f2"}
).max(
{hash_fk_id: MaxKey}
);
query completes successfully after index added.
This collection is created, composite index added to hash_fk_id,fk_type_id then sharded on the leading edge hash_fk_id. Let me know if you need more information.