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

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -