Whenever I try the simple method Createcollection like this:
client.Database("TestCluster").CreateCollection(context.TODO(), "users", options.CreateCollection().SetMaxDocuments(100000))
And I access mongoDB Atlas (free tier) seems like it doesn't have any collection created. My assumption is that I cannot create a collection unless I put some data in it. (I cannot create an empty collection).
Can somebody shine me some light? Thanks :)
Docs: https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo/options#CreateCollectionOptions.SetMaxDocuments https://pkg.go.dev/go.mongodb.org/mongo-driver/mongo#Database.CreateCollection
Dumb me...! Whenever
SetMaxDocuments()
is called you also need to setSetCapped(true)
So yes, it's possible to have an empty collection :)