Add properties and fix fuultext index
@@ -73,6 +73,19 @@ type createIndexDoc struct {
Background bool `bson:"background"`
Sparse bool `bson:"sparse"`
Unique bool `bson:"unique"`
+ DropDups bool `bson:"dropDups"`
+ PartialFilter bson.M `bson:"partialFilter"`
+ ExpireAfter time.Duration `bson:"expireAfter"`
+ Min int `bson:"min"`
+ Max int `bson:"max"`
+ Minf float64 `bson:"minf"`
+ Maxf float64 `bson:"maxf"`
+ BucketSize float64 `bson:"bucketSize"`
+ Bits int `bson:"bits"`
+ DefaultLanguage string `bson:"defaultLanguage"`
+ LanguageOverride string `bson:"languageOverride"`
+ Weights map[string]int `bson:"weigths"`
+ Collation *mgo.Collation `bson:"collation"`
} `bson:"o"`
}
@@ -281,9 +294,22 @@ func processCreateIndex(sess *mgo.Session, buf []byte) error {
index := mgo.Index{
Key: []string{},
Unique: opdoc.O.Unique,
+ DropDups: opdoc.O.DropDups,
Background: opdoc.O.Background,
Sparse: opdoc.O.Sparse,
+ PartialFilter: opdoc.O.PartialFilter,
+ ExpireAfter: opdoc.O.ExpireAfter,
Name: opdoc.O.Name,
+ Min: opdoc.O.Min,
+ Max: opdoc.O.Max,
+ Minf: opdoc.O.Minf,
+ Maxf: opdoc.O.Maxf,
+ BucketSize: opdoc.O.BucketSize,
+ Bits: opdoc.O.Bits,
+ DefaultLanguage: opdoc.O.DefaultLanguage,
+ LanguageOverride: opdoc.O.LanguageOverride,
+ Weights: opdoc.O.Weights,
+ Collation: opdoc.O.Collation,
}
for _, key := range opdoc.O.Key {
@@ -318,8 +344,10 @@ func processCreateIndex(sess *mgo.Session, buf []byte) error {
sign = "-"
}
}
+ if key.Name != "_fts" && key.Name != "_ftsx" {
index.Key = append(index.Key, sign+key.Name)
}
+ }
err := sess.DB(ns).C(opdoc.O.CreateIndexes).EnsureIndex(index)
if err != nil {
return errors.Wrapf(err, "cannot create index %+v", index)
