node.js - Mongoskin MongoClient.connect sync -
in module mongoskin when getting database object mongoskin in sync fashion, hence code:
var db = mongoskin.db(url, { native_parser: true }); var mycollection = db.collection('mycollection');
i curious, how achieve this? i've been looking @ mongoskin code not understand it.
and here, can see mongoskin simplifys :
https://github.com/kissjs/node-mongoskin#dbcollection-callback origin vs. mongoskin
anyone know how mongoskin turned async code sync fashion?
they in beginning of readme:
we make common use functions in promise mode, call skinclass of normal class. , api same official api.
db.collection('mycollection');
returns skincollection
- wrapper native collection
, use collection
when available.
the magic lives here: https://github.com/kissjs/node-mongoskin/blob/master/lib/utils.js
Comments
Post a Comment