diff --git a/scout-brain/lib/replicaset.js b/scout-brain/lib/replicaset.js index 805e0022973..170bd099e9b 100644 --- a/scout-brain/lib/replicaset.js +++ b/scout-brain/lib/replicaset.js @@ -54,16 +54,18 @@ Replicaset.prototype.config = function(fn) { // ```json // { "capped" : true, "size" : 41943040, "autoIndexId" : false } // ``` -Replicaset.prototype.collection = function(fn) { - this.db.db('local').collection('system.namespaces').findOne({ - name: 'local.oplog.rs' - }, function(err, doc) { - if (err) return fn(err); - if (!doc || !doc.options) return fn(boom.badRequest('Not a member of a replicaset.')); - fn(null, doc.options); - }); - return this; -}; + +// TODO(kangas) INT-160 ADD TESTS, FIX FOR WIREDTIGER +// Replicaset.prototype.collection = function(fn) { +// this.db.db('local').collection('system.namespaces').findOne({ +// name: 'local.oplog.rs' +// }, function(err, doc) { +// if (err) return fn(err); +// if (!doc || !doc.options) return fn(boom.badRequest('Not a member of a replicaset.')); +// fn(null, doc.options); +// }); +// return this; +// }; // @api private Replicaset.prototype._status = function(fn) { diff --git a/scout-server/lib/routes/_index.js b/scout-server/lib/routes/_index.js index 069f4b28f03..1ccc1b28c4a 100644 --- a/scout-server/lib/routes/_index.js +++ b/scout-server/lib/routes/_index.js @@ -3,28 +3,30 @@ var debug = require('debug')('scout-server:routes:_index'); module.exports = { list: function(req, res, next) { - req.db.collection('system.indexes', function(err, col) { - col.find({ - ns: req.ns.toString() - }).toArray(function(err, data) { - if (err) return next(err); - res.status(200).send(data); - }); - }); + // TODO(kangas) INT-160 ADD TESTS, FIX FOR WIREDTIGER + // req.db.collection('system.indexes', function(err, col) { + // col.find({ + // ns: req.ns.toString() + // }).toArray(function(err, data) { + // if (err) return next(err); + // res.status(200).send(data); + // }); + // }); }, get: function(req, res, next) { - var query = { - ns: req.ns.toString(), - name: req.param('index_name') - }; + // TODO(kangas) INT-160 ADD TESTS, FIX FOR WIREDTIGER + // var query = { + // ns: req.ns.toString(), + // name: req.param('index_name') + // }; - req.db.collection('system.indexes').findOne(query, function(err, data) { - if (err) return next(err); - if (!data) { - return next(boom.notFound('Index does not exist')); - } - res.status(200).send(data); - }); + // req.db.collection('system.indexes').findOne(query, function(err, data) { + // if (err) return next(err); + // if (!data) { + // return next(boom.notFound('Index does not exist')); + // } + // res.status(200).send(data); + // }); }, destroy: function(req, res, next) { if (req.param('index_name') === '*') { @@ -43,35 +45,36 @@ module.exports = { }); }, create: function(req, res, next) { - var field = req.body.field, - options = req.body.options || {}; + // TODO(kangas) INT-160 ADD TESTS, FIX FOR WIREDTIGER + // var field = req.body.field, + // options = req.body.options || {}; - if (!field) { - return next(boom.badRequest('No field specified.')); - } + // if (!field) { + // return next(boom.badRequest('No field specified.')); + // } - if (typeof options !== 'object') { - return next(boom.badRequest('options must be an object')); - } + // if (typeof options !== 'object') { + // return next(boom.badRequest('options must be an object')); + // } - req.db.createIndex(req.ns.collection, field, options, function(err, name) { - if (err) { - if (err.message.indexOf('bad index key pattern') > -1) { - return next(boom.badRequest('Invalid index key pattern `' + JSON.stringify(field) + '`. Should be {key: [1|-1]}')); - } - return next(err); - } + // req.db.createIndex(req.ns.collection, field, options, function(err, name) { + // if (err) { + // if (err.message.indexOf('bad index key pattern') > -1) { + // return next(boom.badRequest('Invalid index key pattern `' + JSON.stringify(field) + '`. Should be {key: [1|-1]}')); + // } + // return next(err); + // } - req.db.collection('system.indexes', function(err, col) { - col.findOne({ - ns: req.ns.toString(), - name: name - }, function(err, doc) { - if (err) return next(err); - res.status(201).send(doc); - }); - }); - }); + // req.db.collection('system.indexes', function(err, col) { + // col.findOne({ + // ns: req.ns.toString(), + // name: name + // }, function(err, doc) { + // if (err) return next(err); + // res.status(201).send(doc); + // }); + // }); + // }); }, update: function(req, res, next) { var field = req.body.field, diff --git a/scout-server/lib/routes/database.js b/scout-server/lib/routes/database.js index 4a82264ddf5..f26bb404873 100644 --- a/scout-server/lib/routes/database.js +++ b/scout-server/lib/routes/database.js @@ -9,14 +9,14 @@ var boom = require('boom'), debug = require('debug')('scout-server:routes:database'); function getCollectionNames(req, fn) { - req.db.collection('system.namespaces').find({}).toArray(function(err, data) { + req.db.listCollections().toArray(function(err, data) { if (err) return fn(err); if (!data) { return fn(boom.notAuthorized('not authorized to view collections for this database')); } - debug('find(system.namespaces) returned', err, data); + debug('listCollections returned', err, data); var names = data.filter(function(ns) { return !(ns.name.indexOf('$') >= 0 && ns.name.indexOf('.oplog.$') < 0);