softshipper
softshipper

Reputation: 34089

dart authentication system with nosql database

i am planing to write a dart web application with user authentication system, i mean with sign up,sign in and etc.

For managing user information i need a database, i am thinking about to use nosql database. I was searching in internet and found two very interesting nosql database, mongodb and couchdb.

Now my question, which one of them should i choose and which provide a good driver api for dart? I hear about riak too, but i think it is not so popular like mongodb or couchdb.

Upvotes: 0

Views: 444

Answers (1)

Vink
Vink

Reputation: 1277

i don't know if you really need a noSql data base but for me the easier to use is mongoDB. The documentation is good and you can find many implementation.

You can find a package here : mongo_dart It's pretty simple to use :

import 'package:mongo_dart/mongo_dart.dart';

Future<String> getBlogData([String category = '']) {
    print(category);
    Completer c = new Completer();
    _db = new Db("mongodb://127.0.0.1/mysite");
    _db.open().then((o) {
       String data = "[";
       DbCollection collections = this._db.collection("blog_post");
       collections.find(where.sortBy("_id", descending: true)).forEach((v) {
          print(v.runtimeType);
          data += JSON.encode(v) + ",";
       }).then((e) {
         data = data.substring(0, data.length-1);
         data += "]";
         c.complete(data);
       });
     });
    return c.future;
 }

void main() {
    getBlogData("news").then(print);
}

Upvotes: 3

Related Questions