jaguar_mongo 2.2.1 copy "jaguar_mongo: ^2.2.1" to clipboard
jaguar_mongo: ^2.2.1 copied to clipboard

outdated

Mongo interceptor for jaguar

jaguar_mongo #

A MongoDB interceptor for Jaguar.

Usage #

Creating the pool #

Create an instance of MongoPool. Supply essential database configuration. By default, MongoPool builds on a SharedPool. Supply minPoolSize and maxPoolSize to control the pool size.

final mongoPool = MongoPool('mongodb://localhost:27017/test');

Getting and using connection #

Use injectInterceptor method of MongoPool to get a connection to MongoDB. injectInterceptor automatically releases the connection after the request has been serviced or if an exception occurs.

  @GetJson()
  Future<List> readAll(Context ctx) async {
     Db db = await mongoPool.injectInterceptor(ctx); // Get [Db]
    // Use Db to fetch items
    return await (await db.collection('contact').find()).toList();
  }
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

Mongo interceptor for jaguar

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

conn_pool, jaguar, mongo_dart

More

Packages that depend on jaguar_mongo