@@ -3,28 +3,30 @@ var debug = require('debug')('scout-server:routes:_index');
33
44module . exports = {
55 list : function ( req , res , next ) {
6- req . db . collection ( 'system.indexes' , function ( err , col ) {
7- col . find ( {
8- ns : req . ns . toString ( )
9- } ) . toArray ( function ( err , data ) {
10- if ( err ) return next ( err ) ;
11- res . status ( 200 ) . send ( data ) ;
12- } ) ;
13- } ) ;
6+ // TODO(kangas) INT-160 ADD TESTS, FIX FOR WIREDTIGER
7+ // req.db.collection('system.indexes', function(err, col) {
8+ // col.find({
9+ // ns: req.ns.toString()
10+ // }).toArray(function(err, data) {
11+ // if (err) return next(err);
12+ // res.status(200).send(data);
13+ // });
14+ // });
1415 } ,
1516 get : function ( req , res , next ) {
16- var query = {
17- ns : req . ns . toString ( ) ,
18- name : req . param ( 'index_name' )
19- } ;
17+ // TODO(kangas) INT-160 ADD TESTS, FIX FOR WIREDTIGER
18+ // var query = {
19+ // ns: req.ns.toString(),
20+ // name: req.param('index_name')
21+ // };
2022
21- req . db . collection ( 'system.indexes' ) . findOne ( query , function ( err , data ) {
22- if ( err ) return next ( err ) ;
23- if ( ! data ) {
24- return next ( boom . notFound ( 'Index does not exist' ) ) ;
25- }
26- res . status ( 200 ) . send ( data ) ;
27- } ) ;
23+ // req.db.collection('system.indexes').findOne(query, function(err, data) {
24+ // if (err) return next(err);
25+ // if (!data) {
26+ // return next(boom.notFound('Index does not exist'));
27+ // }
28+ // res.status(200).send(data);
29+ // });
2830 } ,
2931 destroy : function ( req , res , next ) {
3032 if ( req . param ( 'index_name' ) === '*' ) {
@@ -43,35 +45,36 @@ module.exports = {
4345 } ) ;
4446 } ,
4547 create : function ( req , res , next ) {
46- var field = req . body . field ,
47- options = req . body . options || { } ;
48+ // TODO(kangas) INT-160 ADD TESTS, FIX FOR WIREDTIGER
49+ // var field = req.body.field,
50+ // options = req.body.options || {};
4851
49- if ( ! field ) {
50- return next ( boom . badRequest ( 'No field specified.' ) ) ;
51- }
52+ // if (!field) {
53+ // return next(boom.badRequest('No field specified.'));
54+ // }
5255
53- if ( typeof options !== 'object' ) {
54- return next ( boom . badRequest ( 'options must be an object' ) ) ;
55- }
56+ // if (typeof options !== 'object') {
57+ // return next(boom.badRequest('options must be an object'));
58+ // }
5659
57- req . db . createIndex ( req . ns . collection , field , options , function ( err , name ) {
58- if ( err ) {
59- if ( err . message . indexOf ( 'bad index key pattern' ) > - 1 ) {
60- return next ( boom . badRequest ( 'Invalid index key pattern `' + JSON . stringify ( field ) + '`. Should be {key: [1|-1]}' ) ) ;
61- }
62- return next ( err ) ;
63- }
60+ // req.db.createIndex(req.ns.collection, field, options, function(err, name) {
61+ // if (err) {
62+ // if (err.message.indexOf('bad index key pattern') > -1) {
63+ // return next(boom.badRequest('Invalid index key pattern `' + JSON.stringify(field) + '`. Should be {key: [1|-1]}'));
64+ // }
65+ // return next(err);
66+ // }
6467
65- req . db . collection ( 'system.indexes' , function ( err , col ) {
66- col . findOne ( {
67- ns : req . ns . toString ( ) ,
68- name : name
69- } , function ( err , doc ) {
70- if ( err ) return next ( err ) ;
71- res . status ( 201 ) . send ( doc ) ;
72- } ) ;
73- } ) ;
74- } ) ;
68+ // req.db.collection('system.indexes', function(err, col) {
69+ // col.findOne({
70+ // ns: req.ns.toString(),
71+ // name: name
72+ // }, function(err, doc) {
73+ // if (err) return next(err);
74+ // res.status(201).send(doc);
75+ // });
76+ // });
77+ // });
7578 } ,
7679 update : function ( req , res , next ) {
7780 var field = req . body . field ,
0 commit comments