mongo-dart / mongo_dart

Mongo_dart: MongoDB driver for Dart programming language
https://pub.dev/packages/mongo_dart
MIT License
446 stars 98 forks source link

Unable to Connect to MongoDB Instance Hosted on AWS EC2 from Flutter #369

Closed zohaib304 closed 6 months ago

zohaib304 commented 6 months ago

When attempting to connect to the MongoDB instance using the mongo_dart package in Flutter, I receive the following error:

MongoDB ConnectionException: Could not connect to [MongoDB_IP]:27017
- HandshakeException: Connection terminated during handshake

Connection String: mongodb://username:<password>@<ip>:27017/testdb

MongoDB Compass successfully connects to the MongoDB instance using the same connection string.

I would appreciate any guidance or assistance. Thank you

giorgiofran commented 6 months ago

It is difficult to say. Try to do a simple dart program (no flutter) and see what happens. Give a look also to this.

zohaib304 commented 6 months ago

I've tried running a simple Dart program without using Flutter, and everything seems to be working fine.