diff options
author | Alexander NeonXP Kiryukhin <a.kiryukhin@mail.ru> | 2019-05-26 10:38:23 +0300 |
---|---|---|
committer | Alexander NeonXP Kiryukhin <a.kiryukhin@mail.ru> | 2019-05-26 10:38:35 +0300 |
commit | a523b636795c25a31a76737b4ccf95f7485d8ec5 (patch) | |
tree | 8884229c1f6c73bd84d506f26d687b712987cfd4 /main.go | |
parent | 109859bf3b1efef71b66563237343f69c009445e (diff) |
fix indexes
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -40,14 +40,14 @@ func read(db *mongo.Database, file string) error { context.Background(), mongo.IndexModel{ Keys: bsonx.Doc{{"osm_id", bsonx.Int32(1)}}, - Options: options.Index().SetUnique(true).SetSparse(true), + Options: options.Index().SetUnique(true).SetSparse(true).SetBackground(true), }, ) _, _ = nodes.Indexes().CreateOne( context.Background(), mongo.IndexModel{ Keys: bsonx.Doc{{"coords", bsonx.Int32(1)}}, - Options: options.Index().SetSphereVersion(2).SetSparse(true), + Options: options.Index().SetSphereVersion(2).SetSparse(true).SetBackground(true), }, ) @@ -56,37 +56,37 @@ func read(db *mongo.Database, file string) error { context.Background(), mongo.IndexModel{ Keys: bsonx.Doc{{"osm_id", bsonx.Int32(1)}}, - Options: options.Index().SetUnique(true).SetSparse(true), + Options: options.Index().SetUnique(true).SetSparse(true).SetBackground(true), }, ) _, _ = ways.Indexes().CreateOne( context.Background(), mongo.IndexModel{ Keys: bsonx.Doc{{"nodes", bsonx.Int32(1)}}, - Options: options.Index().SetSparse(true), + Options: options.Index().SetSparse(true).SetBackground(true), }, ) relations := db.Collection("relations") - _, _ = nodes.Indexes().CreateOne( + _, _ = relations.Indexes().CreateOne( context.Background(), mongo.IndexModel{ Keys: bsonx.Doc{{"osm_id", bsonx.Int32(1)}}, - Options: options.Index().SetUnique(true).SetSparse(true), + Options: options.Index().SetUnique(true).SetSparse(true).SetBackground(true), }, ) - _, _ = nodes.Indexes().CreateOne( + _, _ = relations.Indexes().CreateOne( context.Background(), mongo.IndexModel{ Keys: bsonx.Doc{{"members.ref", bsonx.Int32(1)}}, - Options: options.Index().SetUnique(true).SetSparse(true), + Options: options.Index().SetUnique(true).SetSparse(true).SetBackground(true), }, ) - _, _ = nodes.Indexes().CreateOne( + _, _ = relations.Indexes().CreateOne( context.Background(), mongo.IndexModel{ Keys: bsonx.Doc{{"members.coords", bsonx.Int32(1)}}, - Options: options.Index().SetSphereVersion(2).SetSparse(true), + Options: options.Index().SetSphereVersion(2).SetSparse(true).SetBackground(true), }, ) |