Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/v0.11.3'

  • Loading branch information...
commit 0b416ab4b867465ce4f6102cad65b26c9ea456a7 2 parents 41921d6 + dafe00d
@andzdroid authored
View
9 README.md
@@ -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
16 filters.js
@@ -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  package.json
@@ -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
5 routes/document.js
@@ -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);
View
8 views/collection.html
@@ -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>
Please sign in to comment.
Something went wrong with that request. Please try again.