google-code-export / morphia

Automatically exported from code.google.com/p/morphia
1 stars 0 forks source link

Order of composite keys seems to be lost #286

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What version are you using? 
Morphia 1.00-SNAPSHOT
Mongo 1.8.1

I created an Index via the annotation like this:

@Indexes({
   @Index(value = "indices.textLc,group,language,cluster,lengthPlain", background = true),

I then see a new index is created called 
"indices.textLc_1_group_1_language_1_cluster_1_lengthPlain_1"

but the key order is:
cluster
group
indices.textLc
language
lengthPlain

It looks like the fields are created in alphabetic order, but isn't the order 
of fields in the index important? Looks like a bug.

Original issue reported on code.google.com by heaths.h...@gmail.com on 17 Jun 2011 at 12:20

GoogleCodeExporter commented 9 years ago
What does db.coll.getIndexes() look like from the shell? The name seems to 
imply it was created in the correct order (which is done by the driver, not 
morphia).

Original comment by scotthernandez on 17 Jun 2011 at 12:29

GoogleCodeExporter commented 9 years ago
Hmm. It seems that my client MongoHub decided to reorder the keys when it 
displayed them :( Sorry for the false alarm. The shell gives:

    {
        "name" : "indices.text_1_group_1_language_1_cluster_1_lengthPlain_1",
        "ns" : "jerome5.Example",
        "background" : true,
        "key" : {
            "indices.text" : 1,
            "group" : 1,
            "language" : 1,
            "cluster" : 1,
            "lengthPlain" : 1
        },
        "v" : 0

Nicholas Cottrell
Transmachina Language Technologies      Website translation technology
http://www.transmachina.com/                Multilingual software development
Stockholm, Sweden                       Web communication consultants  

Email: nic@transmachina.com
Skype: niccottrell
Ph. +46 70 885 9690

Original comment by heaths.h...@gmail.com on 17 Jun 2011 at 1:05

GoogleCodeExporter commented 9 years ago

Original comment by scotthernandez on 17 Jun 2011 at 1:09