@@ -24,18 +24,21 @@ function getCollectionFeatures(req, fn) {
24
24
req . db . command ( {
25
25
collStats : req . ns . collection
26
26
} , {
27
- verbose : 1
28
- } , function ( err , data ) {
29
- if ( err ) return fn ( err ) ;
30
-
31
- req . collection_features = {
32
- capped : data . capped ,
33
- max : data . max ,
34
- size : data . size ,
35
- power_of_two : data . userFlags === 1
36
- } ;
37
- fn ( null , req . collection_features ) ;
38
- } ) ;
27
+ verbose : 1
28
+ } , function ( err , data ) {
29
+ if ( err ) return fn ( err ) ;
30
+
31
+ req . collection_features = {
32
+ capped : data . capped ,
33
+ max_document_count : data . max ,
34
+ max_document_size : data . maxSize ,
35
+ size : data . size ,
36
+ power_of_two : data . userFlags === 1 ,
37
+ index_details : data . indexDetails || { } ,
38
+ wired_tiger : data . wiredTiger || { }
39
+ } ;
40
+ fn ( null , req . collection_features ) ;
41
+ } ) ;
39
42
}
40
43
41
44
function getCollectionStats ( req , fn ) {
@@ -47,33 +50,29 @@ function getCollectionStats(req, fn) {
47
50
req . db . command ( {
48
51
collStats : req . ns . collection
49
52
} , {
50
- verbose : 1
51
- } , function ( err , data ) {
52
- if ( err ) return fn ( err ) ;
53
-
54
- req . collection_stats = {
55
- index_sizes : data . indexSizes ,
56
- document_count : data . count ,
57
- document_size : data . size ,
58
- storage_size : data . storageSize ,
59
- index_count : data . nindexes ,
60
- index_size : data . totalIndexSize ,
61
- padding_factor : data . paddingFactor ,
62
- extent_count : data . numExtents ,
63
- extent_last_size : data . lastExtentSize ,
64
- flags_user : data . userFlags ,
65
- flags_system : data . systemFlags
66
- } ;
67
- fn ( null , req . collection_stats ) ;
68
- } ) ;
53
+ verbose : 1
54
+ } , function ( err , data ) {
55
+ if ( err ) return fn ( err ) ;
56
+
57
+ req . collection_stats = {
58
+ index_sizes : data . indexSizes ,
59
+ document_count : data . count ,
60
+ document_size : data . size ,
61
+ storage_size : data . storageSize ,
62
+ index_count : data . nindexes ,
63
+ index_size : data . totalIndexSize ,
64
+ padding_factor : data . paddingFactor ,
65
+ extent_count : data . numExtents ,
66
+ extent_last_size : data . lastExtentSize ,
67
+ flags_user : data . userFlags ,
68
+ flags_system : data . systemFlags
69
+ } ;
70
+ fn ( null , req . collection_stats ) ;
71
+ } ) ;
69
72
}
70
73
71
74
function getCollectionIndexes ( req , fn ) {
72
- req . db . collection ( 'system.indexes' )
73
- . find ( {
74
- ns : req . ns . toString ( )
75
- } )
76
- . toArray ( fn ) ;
75
+ req . db . collection ( req . ns . collection ) . listIndexes ( ) . toArray ( fn ) ;
77
76
}
78
77
79
78
// @todo : Move to scount-sync.collection.fetch().
@@ -128,14 +127,14 @@ module.exports = {
128
127
query : req . json ( 'query' ) ,
129
128
size : req . int ( 'size' , 5 )
130
129
} )
131
- . pipe ( _idToDocument ( req . db , req . ns . collection , {
132
- fields : req . json ( 'fields' )
133
- } ) )
134
- . pipe ( EJSON . createStringifyStream ( ) )
135
- . pipe ( setHeaders ( req , res , {
136
- 'content-type' : 'application/json'
137
- } ) )
138
- . pipe ( res ) ;
130
+ . pipe ( _idToDocument ( req . db , req . ns . collection , {
131
+ fields : req . json ( 'fields' )
132
+ } ) )
133
+ . pipe ( EJSON . createStringifyStream ( ) )
134
+ . pipe ( setHeaders ( req , res , {
135
+ 'content-type' : 'application/json'
136
+ } ) )
137
+ . pipe ( res ) ;
139
138
140
139
} ,
141
140
bulk : function ( req , res , next ) {
0 commit comments