Permalink
Browse files

Merge branch 'release/v0.9.0'

  • Loading branch information...
2 parents 7f2807f + da8a051 commit fa65e1b3ee14649351ab207b29ec0dc007c718a8 @andzdroid andzdroid committed May 6, 2012
Showing with 19 additions and 4 deletions.
  1. +2 −2 README.md
  2. +1 −0 app.js
  3. +1 −1 package.json
  4. +12 −0 routes/document.js
  5. +1 −0 routes/index.js
  6. +2 −1 views/collection.html
View
@@ -12,11 +12,11 @@ Current features:
* Supports multiple databases
* Database blacklist/whitelist
* View/add/rename/delete collections
-* View/update documents
+* View/update/delete documents
Planned features:
-* Add/delete documents
+* Add documents
* Support for replica set connections
* Web-based command-line interface
* Site authentication
View
1 app.js
@@ -252,6 +252,7 @@ app.get('/', middleware, routes.index);
app.get('/db/:database/:collection/:document', middleware, routes.viewDocument);
app.put('/db/:database/:collection/:document', middleware, routes.updateDocument);
+app.del('/db/:database/:collection/:document', middleware, routes.deleteDocument);
app.get('/db/:database/:collection', middleware, routes.viewCollection);
app.put('/db/:database/:collection', middleware, routes.renameCollection);
View
@@ -2,7 +2,7 @@
"author": "Chun-hao Hu <hu.chunhao@gmail.com> (http://blog.huchunhao.com)",
"name": "mongo-express",
"description": "Web-based admin interface for MongoDB",
- "version": "0.8.1",
+ "version": "0.9.0",
"repository": {
"type": "git",
"url": "git://github.com/andzdroid/mongo-express.git"
View
@@ -42,3 +42,15 @@ exports.updateDocument = function(req, res, next) {
return res.redirect('/db/' + req.dbName + '/' + req.collectionName);
});
};
+
+
+exports.deleteDocument = function(req, res, next) {
+ req.collection.remove({_id: req.document._id}, {safe: true}, function(err, result) {
+ if (err) {
+ //TODO: handle error
+ console.error(err);
+ }
+
+ return res.redirect('/db/' + req.dbName + '/' + req.collectionName);
+ });
+};
View
@@ -12,6 +12,7 @@ exports.renameCollection = coll.renameCollection;
exports.viewDocument = doc.viewDocument;
exports.updateDocument = doc.updateDocument;
+exports.deleteDocument = doc.deleteDocument;
//Homepage route
View
@@ -76,9 +76,10 @@
<br /><br />
<form method="POST" action="db/{{ dbName }}/{{ collectionName }}/{{ document._id }}">
<input type="hidden" name="_method" value="delete">
- <button type="submit" class="btn btn-danger btn-mini">
+ <button type="submit" name="submit" class="btn btn-danger btn-mini">
<i class="icon-remove icon-white"></i>
</button>
+ </form>
</div>
</div>
{% endfor %}

0 comments on commit fa65e1b

Please sign in to comment.