SHARE
TWEET

Untitled

a guest Jun 17th, 2019 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:mongo_dart/mongo_dart.dart';
  2.  
  3. void main() async {
  4.  
  5. Db db = new Db("mongodb://localhost:27017/test");
  6. await db.open();
  7. print('Connection succeeded!');
  8. //the test database is accessible from Compass or terminal
  9. //localhost:27017 works well  
  10. }
  11.  
  12. await db.open() throws that error:
  13. dart_sdk.js:5822 Uncaught Error: Unsupported operation: Socket
  14. constructor
  15. at Object.dart.throw (dart_sdk.js:4537)
  16. at Function._connect (dart_sdk.js:52279)
  17. at Function.connect (dart_sdk.js:52264)
  18. at mongo_dart._Connection.new.connect (connection.dart:56)
  19. at mongo_dart._ConnectionManager.new._connect
  20. (connection_manager.dart:23)
  21. at _connect.next (<anonymous>)
  22. at runBody (dart_sdk.js:22269)
  23. at Object.async.async (dart_sdk.js:22297)
  24. at mongo_dart._ConnectionManager.new.[_connect]
  25. (connection_manager.dart:22)
  26. at connection_manager.dart:58
  27. at dart_sdk.js:23887
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top