mgo

panic reading index

Bug #1190822 reported by Nick Stott
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mgo
New
Undecided
Unassigned

Bug Description

Hi All,

I'm getting a panic reading an index using mgo, go1.1, on a recent osx.

when I add an index via the mongo cli as follows,

pantstastic:PRIMARY> db.foo.ensureIndex({whoop:1})
pantstastic:PRIMARY> db.foo.getIndexes()
[
 {
  "v" : 1,
  "key" : {
   "_id" : 1
  },
  "ns" : "test.foo",
  "name" : "_id_"
 },
 {
  "v" : 1,
  "key" : {
   "whoop" : 1
  },
  "ns" : "test.foo",
  "name" : "whoop_1"
 }
]

and then read the index by:

indexes, err := sess.DB("test").C("foo").Indexes()

I get a panic: Got unknown index key type for field whoop

It seems that for some reason, the function simpleIndexKey in mgo's session.go expects the key to have a value that's either an integer or a string. on my system, realKey[i].Value seems to think that it's a float64

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.