I want to use mongo atlas in my flutter project and currently, I am using the mongo_dart package and I am able to add documents directly from my app.
var db = await Db.create("mongodb+srv://<username>:<password>@cluster0.cwdcc.mongodb.net/<database>?retryWrites=true&w=majority");
await db.open();
var coll = db.collection('Users');
Recently I saw someone saying that I need to create API and it is not good to use MongoDB like this. Can you explain Why is that I need to create an API?