Comparing version
@@ -1,5 +0,3 @@ | ||
var mongoskin = require('../lib/mongoskin'); | ||
var db = require('./config').db; | ||
var db = mongoskin.db('localhost/test'); | ||
db.gridfs().open('test.txt', 'w', function(err, gs) { | ||
@@ -6,0 +4,0 @@ gs.write('blablabla', function(err, reply) { |
@@ -0,1 +1,23 @@ | ||
0.3.3 / 2011-03-15 | ||
================== | ||
* Add rootCollection option to SkinGridStore.exist | ||
0.3.2 / 2011-03-01 | ||
================== | ||
* exports all classes of node-mongodb-native | ||
0.3.1 / 2011-02-26 | ||
================== | ||
* bug fix #33 | ||
0.3.0 / 2011-01-19 | ||
================== | ||
* add ReplSet support | ||
* bug fix | ||
0.2.3 / 2011-01-03 | ||
================== | ||
* add db.toObjectID | ||
* fix #25 for node-mongodb-native update | ||
0.2.2 / 2011-12-02 | ||
@@ -2,0 +24,0 @@ ================== |
@@ -98,7 +98,7 @@ /** | ||
case STATE_OPENNING: | ||
return this.emitter.addListener('open', fn); | ||
return this.emitter.once('open', fn); | ||
case STATE_CLOSE: | ||
default: | ||
var that = this; | ||
this.emitter.addListener('open', fn); | ||
this.emitter.once('open', fn); | ||
this.state = STATE_OPENNING; | ||
@@ -105,0 +105,0 @@ this.skinDb.open(function(err, db) { |
@@ -25,7 +25,7 @@ var __slice = Array.prototype.slice, | ||
case STATE_OPENNING: | ||
return this.emitter.addListener('open', fn); | ||
return this.emitter.once('open', fn); | ||
case STATE_CLOSE: | ||
default: | ||
var that = this; | ||
this.emitter.addListener('open', fn); | ||
this.emitter.once('open', fn); | ||
this.state = STATE_OPENNING; | ||
@@ -32,0 +32,0 @@ this.skinCollection.open(function(err, collection) { |
@@ -54,3 +54,3 @@ var __slice = Array.prototype.slice, | ||
// if call 'open' method multi times before opened | ||
return this.emitter.addListener('open', fn); | ||
return this.emitter.once('open', fn); | ||
@@ -71,3 +71,3 @@ case STATE_CLOSE: | ||
this.emitter.addListener('open', fn); | ||
this.emitter.once('open', fn); | ||
this.state = STATE_OPENNING; | ||
@@ -74,0 +74,0 @@ |
@@ -33,5 +33,5 @@ var GridStore = require('mongodb').GridStore; | ||
SkinGridStore.prototype.exist = function(filename, callback){ | ||
SkinGridStore.prototype.exist = function(filename, rootCollection, callback){ | ||
this.skinDb.open(function(err, db) { | ||
GridStore.exist(db, filename, callback); | ||
GridStore.exist(db, filename, rootCollection, callback); | ||
}); | ||
@@ -38,0 +38,0 @@ } |
@@ -55,3 +55,7 @@ var url = require('url'), | ||
function MongoSkin() { | ||
/* | ||
* exports mongo classes ObjectID Long Code DbRef ... to mongoskin | ||
*/ | ||
for(var key in mongo) { | ||
exports[key] = mongo[key]; | ||
} | ||
@@ -73,3 +77,3 @@ | ||
*/ | ||
MongoSkin.prototype.db = function(serverUrl, options) { | ||
exports.db = function(serverUrl, options) { | ||
if(!options) { | ||
@@ -134,8 +138,6 @@ options = {}; | ||
*/ | ||
MongoSkin.prototype.router = function(select) { | ||
exports.router = function(select) { | ||
return new Router(select); | ||
} | ||
}; | ||
var mongoskin = new MongoSkin(); | ||
/* | ||
@@ -149,7 +151,4 @@ * export Skin classes from ./db ./collection ./cursor ./admin | ||
foo = module[name]; | ||
mongoskin[name] = foo; | ||
exports[name] = foo; | ||
} | ||
}); | ||
module.exports = mongoskin; | ||
{ | ||
"name": "mongoskin", | ||
"description": "The future layer above node-mongodb-native", | ||
"version": "0.3.0", | ||
"version": "0.3.3", | ||
"author": "Jason Green <guileen@gmail.com>", | ||
@@ -6,0 +6,0 @@ "repository": { |
@@ -0,3 +1,19 @@ | ||
## This project is a wrapper of node-mongodb-native | ||
* node-mongodb-native document http://christkv.github.com/node-mongodb-native/ | ||
## How to generate unique Id? | ||
see [examples/generateId](https://github.com/guileen/node-mongoskin/blob/master/examples/generateId.js) by | ||
[node-shorten](https://github.com/guileen/node-shorten) | ||
## How to validate input? | ||
I wrote a middleware to validate post data, [node-iform](https://github.com/guileen/node-iform) | ||
base on [node-validator](https://github.com/chriso/node-validator) | ||
<a name='index'> | ||
# Mongoskin document | ||
* [Nodejs mongodb drivers comparation](#comparation) | ||
@@ -225,4 +241,41 @@ * [Install](#install) | ||
### classes extends frome node-mongodb-native | ||
* BSONPure | ||
* BSONNative | ||
* BinaryParser | ||
* Binary | ||
* Code | ||
* DBRef | ||
* Double | ||
* MaxKey | ||
* MinKey | ||
* ObjectID | ||
* Symbol | ||
* Timestamp | ||
* Long | ||
* BaseCommand | ||
* DbCommand | ||
* DeleteCommand | ||
* GetMoreCommand | ||
* InsertCommand | ||
* KillCursorCommand | ||
* QueryCommand | ||
* UpdateCommand | ||
* MongoReply | ||
* Admin | ||
* Collection | ||
* Connection | ||
* Server | ||
* ReplSetServers | ||
* Cursor | ||
* Db | ||
* connect | ||
* Grid | ||
* Chunk | ||
* GridStore | ||
* native | ||
* pure | ||
[Back to index](#index) | ||
@@ -229,0 +282,0 @@ |
46486
5.68%21
23.53%1004
5.02%578
10.1%