Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Version bump, fixes #13

  • Loading branch information...
commit a096343ef81cddddfd810ae3e73ff4095f496510 1 parent d6a8f22
@tdegrunt authored
View
9 README.md
@@ -37,10 +37,15 @@ Content Type:
* Please make sure `application/json` is used as Content-Type when using POST/PUT with request body's.
+Dependencies:
+
+* Are all indicated in package.json. So far I indicate the lowest version with which I tested the code. Sadly this can result in non-working code when later versions are used.
+
Testing
-------
-Testing is now done using expresso. Just run `expresso -s` in the main folder.
+Testing is now done using expresso. Just run the following in the main folder:
+`expresso -s test/create.test.js test/delete.test.js test/update.test.js`
The SproutCore test needs to be run separately at the moment.
Future
@@ -54,4 +59,4 @@ Credits
* [MongoDB Driver](http://github.com/christkv/node-mongodb-native)
* [Express](http://expressjs.com/)
-* [npm](http://npmjs.org/)
+* [npm](http://npmjs.org/)
View
4 config.json
@@ -7,6 +7,6 @@
"port": 3000,
"address": "0.0.0.0"
},
- "flavor": "regular",
+ "flavor": "sproutcore",
"debug": true
-}
+}
View
9 lib/rest.js
@@ -9,7 +9,8 @@
var mongo = require("mongodb"),
app = module.parent.exports.app,
config = module.parent.exports.config,
- util = require("./util");
+ util = require("./util"),
+ BSON = mongo.BSONNative;
/**
* Query
@@ -19,7 +20,7 @@ app.get('/:db/:collection/:id?', function(req, res) {
// Providing an id overwrites giving a query in the URL
if (req.params.id) {
- query = {'_id': new mongo.ObjectID(req.params.id)};
+ query = {'_id': new BSON.ObjectID(req.params.id)};
}
var options = req.params.options || {};
@@ -87,7 +88,7 @@ app.post('/:db/:collection', function(req, res) {
* Update
*/
app.put('/:db/:collection/:id', function(req, res) {
- var spec = {'_id': new mongo.ObjectID(req.params.id)};
+ var spec = {'_id': new BSON.ObjectID(req.params.id)};
var db = new mongo.Db(req.params.db, new mongo.Server(config.db.host, config.db.port, {'auto_reconnect':true}));
db.open(function(err, db) {
@@ -105,7 +106,7 @@ app.put('/:db/:collection/:id', function(req, res) {
* Delete
*/
app.del('/:db/:collection/:id', function(req, res) {
- var spec = {'_id': new mongo.ObjectID(req.params.id)};
+ var spec = {'_id': new BSON.ObjectID(req.params.id)};
var db = new mongo.Db(req.params.db, new mongo.Server(config.db.host, config.db.port, {'auto_reconnect':true}));
db.open(function(err, db) {
View
6 package.json
@@ -1,14 +1,14 @@
{
"name": "mongodb-rest",
"description": "REST API Server for MongoDB",
- "version": "0.6.7",
+ "version": "0.6.8",
"author": "Tom de Grunt <tom@degrunt.nl>",
"contributors": [
{ "name": "Tom de Grunt", "email": "tom@degrunt.nl" }
],
- "dependencies": { "express": ">= 2.2.0", "mongodb": ">= 0.7.9", "jade": ">= 0.10.2" },
+ "dependencies": { "express": ">= 2.2.0", "mongodb": ">= 0.9.2", "jade": ">= 0.10.3" },
"keywords": ["mongodb", "mongo", "db", "web", "rest", "restful"],
"directories": { "lib": "./lib" },
"bin": { "mongodb-rest": "./bin/mongodb-rest" },
- "engines": { "node": ">= 0.4.2" }
+ "engines": { "node": ">= 0.4.4" }
}
View
7 test/create.test.js
@@ -1,10 +1,11 @@
-var server = require('../server');
+var server = require('../server'),
+ assert = require('assert');
app = server.app;
server.config.flavor = "regular";
module.exports = {
- 'Create a simple Document': function(assert){
+ 'Create a simple Document': function(){
// First create the document
assert.response(app, {
@@ -40,4 +41,4 @@ module.exports = {
});
});
}
-};
+};
View
7 test/delete.test.js
@@ -1,10 +1,11 @@
-var server = require('../server');
+var server = require('../server'),
+ assert = require('assert');
app = server.app;
server.config.flavor = "regular";
module.exports = {
-'Delete a Document': function(assert){
+'Delete a Document': function(){
// First create the document
assert.response(app, {
@@ -57,4 +58,4 @@ module.exports = {
});
});
}
-};
+};
View
7 test/sproutcore.test.js
@@ -1,8 +1,9 @@
-var server = require('../server');
+var server = require('../server'),
+ assert = require('assert');
app = server.app;
module.exports = {
- 'SproutCore flavor': function(assert){
+ 'SproutCore flavor': function(){
server.config.flavor = "sproutcore";
// First create the document
@@ -39,4 +40,4 @@ module.exports = {
});
});
}
-};
+};
View
7 test/update.test.js
@@ -1,10 +1,11 @@
-var server = require('../server');
+var server = require('../server'),
+ assert = require('assert');
app = server.app;
server.config.flavor = "regular";
module.exports = {
-'Update a Document': function(assert){
+'Update a Document': function(){
// First create the document
assert.response(app, {
@@ -66,4 +67,4 @@ module.exports = {
});
});
}
-};
+};
Please sign in to comment.
Something went wrong with that request. Please try again.