From a523b636795c25a31a76737b4ccf95f7485d8ec5 Mon Sep 17 00:00:00 2001 From: Alexander NeonXP Kiryukhin Date: Sun, 26 May 2019 10:38:23 +0300 Subject: fix indexes --- main.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 1458fe8..9ae13e9 100644 --- a/main.go +++ b/main.go @@ -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), }, ) -- cgit v1.2.3