Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'release/v0.2.1'

  • Loading branch information...
commit e11d023b2816d6fb3e167eb6b36bc97fac2458cb 2 parents fbc919c + 387628c
@andzdroid authored
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": "1.2.0",
+ "version": "0.2.1",
"repository": {
"type": "git",
"url": "git://github.com/andzdroid/mongo-express.git"
View
4 public/stylesheets/bootstrap.css
@@ -1757,7 +1757,7 @@ table .span24 {
*margin-right: .3em;
line-height: 14px;
vertical-align: text-top;
- background-image: url("../img/glyphicons-halflings.png");
+ background-image: url("../images/glyphicons-halflings.png");
background-position: 14px 14px;
background-repeat: no-repeat;
}
@@ -1768,7 +1768,7 @@ table .span24 {
}
.icon-white {
- background-image: url("../img/glyphicons-halflings-white.png");
+ background-image: url("../images/glyphicons-halflings-white.png");
}
.icon-glass {
View
20 routes/collection.js
@@ -10,7 +10,7 @@ exports.collection = function(req, res, next) {
//remove database prefix from collection name
var coll_name = utils.parseCollectionName(collection_name);
- //get documents from the collection
+ //get collection
db.collection(coll_name, function(err, collection) {
if (err) {
//TODO: handle error
@@ -22,14 +22,18 @@ exports.collection = function(req, res, next) {
skip: 0
};
+ //get documents from the collection
collection.find({}, query_options).toArray(function(err, items) {
- var ctx = {
- title: 'Viewing Collection: ' + collection_name,
- collection: collection_name,
- documents: items
- };
-
- res.render('collection', ctx);
+ collection.stats(function(err, stats) {
+ var ctx = {
+ title: 'Viewing Collection: ' + collection_name,
+ collection: collection_name,
+ documents: items,
+ stats: stats
+ };
+
+ res.render('collection', ctx);
+ });
});
});
};
View
33 views/collection.html
@@ -21,11 +21,42 @@
</table>
{% endif %}
+<h2>Collection Stats</h2>
+<table class="table table-bordered table-striped">
+ <tr>
+ <td class="span3"><strong>Number of documents</strong></td>
+ <td class="span2">{{ stats.count }}</td>
+ <td class="span3"><strong>Pre-allocated space</strong></td>
+ <td class="span2">{{ stats.storageSize }} bytes</td>
+ </tr>
+ <tr>
+ <td><strong>Total document size</strong></td>
+ <td>{{ stats.size }} bytes</td>
+ <td><strong>Average document size</strong></td>
+ <td>{{ stats.avgObjSize }} bytes</td>
+ </tr>
+ <tr>
+ <td><strong>Number of indexes</strong></td>
+ <td>{{ stats.nindexes }}</td>
+ <td><strong>Padding factor</strong></td>
+ <td>{{ stats.paddingFactor }}</td>
+ </tr>
+ <tr>
+ <td><strong>Total index size</strong></td>
+ <td>{{ stats.totalIndexSize }} bytes</td>
+ <td><strong>Number of extents</strong></td>
+ <td>{{ stats.numExtents }}</td>
+</table>
+
+
<h2>Delete Collection</h2>
<form method="POST" action="db/{{ collection }}" class="well">
<input type="hidden" name="_method" value="delete">
<p>Are you sure you want to delete this collection? All documents will be deleted.</p>
- <button type="submit" class="btn btn-danger btn-large">Delete</button>
+ <button type="submit" class="btn btn-danger btn-large">
+ <i class="icon-trash icon-white"></i>
+ Delete
+ </button>
</form>
{% endblock %}
View
5 views/index.html
@@ -11,7 +11,10 @@
<span class="add-on">{{ database }} . </span>
<input class="span2" type="text" id="collection_name" name="collection_name" placeholder="Collection Name">
</div>
- <button type="submit" class="btn btn-primary">Create collection</button>
+ <button type="submit" class="btn btn-primary">
+ <i class="icon-folder-open icon-white"></i>
+ Create collection
+ </button>
</form>
{% endblock %}
Please sign in to comment.
Something went wrong with that request. Please try again.