If I call the CreateCollection method on a pre-existing collection like:
coll := client.Database(databaseName).Collection(collectionName)
err := client.Database(databaseName).CreateCollection(context.Background(), collectionName)
iferr != nil {
log.Fatalf("failed to create vector store collection: %v", err)
}
I would expect it to give me an error as per the documentation:
If the collection being created already exists, this method will return a mongo.CommandError.
See https://pkg.go.dev/go.mongodb.org/mongo-driver/v2@v2.0.0/mongo#Database.CreateCollection
Either the documentation should be updated, or the error should be returned (or my understanding of Go errors is incorrect).