Kev
unread,Dec 31, 2011, 4:12:33 PM12/31/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
I have a table, mytable with indexes hash_1__id_1 and hash_1_uid_1.
The shard key of the table is hash_1__id_1.
By executing the following query:
db.mytable.find({'hash' : 1234, 'uid', 1111})
using explain i see that it is actually using the hash_1__id_1 index
instead of the hash_1_uid_1.
Is this because of the fact that hash_1__id_1 is the sharded key? I
tried to force it to use the other index to see if it is faster as
follows:
db.mytable.find({'hash' : 1234, 'uid', 1111}).hint("hash_1_uid_1")
but that results in an error:
Sat Dec 31 16:03:42 uncaught exception: error: {
"$err" : "could not initialize cursor across all shards because : bad
hint @ database5/shard5:27018,shard5r:27018",
"code" : 14827
}
Is this a problem with my shard key? Or is there a way around this.
Much appreciated and happy new year!