Hi,
I have a document with a structure similair to the following:
"s": {
"a": 16,
"sc": 1,
"g": 'M'
}
I am trying to create an index on the individual fields like "a", "sc"
and "g". In the shell I can do something like
db.mycoll.ensureIndex( { "s.a" : 1, "
s.sc" : 1, "s.g" : 1 }) and it
works fine (although I'm not sure if this is how I am supposed to be
doing it).
If I try this in the driver
using ...GetCollection("mycoll").EnsureIndex("s.a", "s,sc", "s.g"); I
get a BsonSerializationException "Element name '
s.sc' is not valid
because it contains a '.'
Is there a reason why the driver is carrying out this validation in
this instance (as the syntax is indeed valid according to the official
documentation - see compound indexes here
http://www.mongodb.org/display/DOCS/Indexes#Indexes-DocumentsasKeys)?
Is there an alternative to creating these indexes using the driver?
Cheers!
Gav