Permalink
Browse files

Merge branch 'release/v0.11.3'

  • Loading branch information...
2 parents 41921d6 + dafe00d commit 0b416ab4b867465ce4f6102cad65b26c9ea456a7 @andzdroid andzdroid committed May 8, 2012
Showing with 30 additions and 10 deletions.
  1. +7 −2 README.md
  2. +16 −0 filters.js
  3. +1 −1 package.json
  4. +2 −3 routes/document.js
  5. +4 −4 views/collection.html
View
@@ -21,8 +21,13 @@ Planned features:
* Web-based command-line interface
* Site authentication
-Currently mongo-express *requires* admin access to the database.
-Support for regular user connections will be coming soon.
+Limitations
+-----------
+
+* Requires admin authentication details
+* Requires documents to have an _id property
+* Cannot edit document._id
+* Cannot use regular user authentication
Screenshots
View
@@ -1,3 +1,19 @@
exports.json = function(input) {
return JSON.stringify(input, null, ' ');
};
+
+exports.convertBytes= function(input) {
+ input = parseInt(input, 10);
+ if (input < 1024) {
+ return input.toString() + ' Bytes';
+ } else if (input < 1024 * 1024) {
+ //Convert to KB and keep 2 decimal values
+ input = Math.round((input / 1024) * 100) / 100;
+ return input.toString() + ' KB';
+ } else if (input < 1024 * 1024 * 1024) {
+ input = Math.round((input / (1024 * 1024)) * 100) / 100;
+ return input.toString() + ' MB';
+ } else {
+ return input.toString() + ' Bytes';
+ }
+};
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.11.2",
+ "version": "0.11.3",
"repository": {
"type": "git",
"url": "git://github.com/andzdroid/mongo-express.git"
View
@@ -59,8 +59,7 @@ exports.updateDocument = function(req, res, next) {
docJSON._id = req.document._id;
- //TODO: change collection.save to collection.update, figure out how to use ObjectID
- req.collection.update({_id: docJSON._id}, docJSON, {safe: true}, function(err, result) {
+ req.collection.update(req.document, docJSON, {safe: true}, function(err, result) {
if (err) {
//TODO: handle error
//document was not saved
@@ -74,7 +73,7 @@ exports.updateDocument = function(req, res, next) {
exports.deleteDocument = function(req, res, next) {
- req.collection.remove({_id: req.document._id}, {safe: true}, function(err, result) {
+ req.collection.remove(req.document, {safe: true}, function(err, result) {
if (err) {
//TODO: handle error
console.error(err);
@@ -204,15 +204,15 @@
</li>
<li>
<strong>Total doc size</strong>
- <span class="pull-right">{{ stats.size }} bytes</span>
+ <span class="pull-right">{{ stats.size|convertBytes }}</span>
</li>
<li>
<strong>Average doc size</strong>
- <span class="pull-right">{{ stats.avgObjSize }} bytes</span>
+ <span class="pull-right">{{ stats.avgObjSize|convertBytes }}</span>
</li>
<li>
<strong>Pre-allocated size</strong>
- <span class="pull-right">{{ stats.storageSize }} bytes</span>
+ <span class="pull-right">{{ stats.storageSize|convertBytes }}</span>
</li>
<li>&nbsp;</li>
<li>
@@ -221,7 +221,7 @@
</li>
<li>
<strong>Total index size</strong>
- <span class="pull-right">{{ stats.totalIndexSize }} bytes</span>
+ <span class="pull-right">{{ stats.totalIndexSize|convertBytes }}</span>
</li>
<li>&nbsp;</li>
<li>

0 comments on commit 0b416ab

Please sign in to comment.