Charly Samosir
Charly Samosir

Reputation: 1

Angulardart + Mongodb

I just tried angulardart, I want to use mongodb as a database, I use package: mongo_dart, this is my code

main.dart

can be seen, I want to retrieve data from the Mongo database "contact-db" collection "contact-collection" then display it on the console, but I get this error

error in console chrome

"dart_sdk.js:4835 Uncaught core.UnsupportedError.new {Symbol(UnsupportedError.message): "Socket constructor", Symbol(_error): Error at Object.dart.throw (http://localhost:8080/packages/$sdk/dev_compiler/amd/dart_sdk.js:483…"

what I want to ask is:

  1. Is this error from a package, if there is a solution for this error?
  2. does this error come from my code, if so please give me a solution?
  3. Is there another way to use it so that I can use angulardart with mongodb as a database?

Thank you in advance

Upvotes: 0

Views: 219

Answers (1)

Luis Vargas
Luis Vargas

Reputation: 2524

First of all, mongodb can only be accessed from a server-side application. Saying that, you would need to create 2 applications, one for client-side written using angular-dart and another one for the server-side using shelf maybe.

Right now the only databases that allows connecting directly from the client-side are firebase and firestore.

Upvotes: 1

Related Questions