1
- var AmpersandState = require ( 'ampersand-state' ) ;
2
1
var AmpersandModel = require ( 'ampersand-model' ) ;
3
- var AmpersandCollection = require ( 'ampersand-collection' ) ;
4
- var debug = require ( 'debug' ) ( 'scout-brain:models:collection' ) ;
5
-
2
+ var _ = require ( 'underscore' ) ;
6
3
var types = require ( '../types' ) ;
7
-
8
- // @todo : When schema for Index finalized in server,
9
- // make them real props here.
10
- var CollectionIndex = AmpersandState . extend ( {
11
- extraProperties : 'allow'
12
- } ) ;
13
-
14
- var CollectionIndexes = AmpersandCollection . extend ( {
15
- model : CollectionIndex
16
- } ) ;
4
+ var IndexCollection = require ( './_index-collection' ) ;
17
5
18
6
var Collection = AmpersandModel . extend ( {
19
7
idAttribute : '_id' ,
@@ -23,7 +11,6 @@ var Collection = AmpersandModel.extend({
23
11
required : true
24
12
} ,
25
13
database : 'string' ,
26
- index_sizes : 'number' ,
27
14
document_count : 'number' ,
28
15
document_size : 'number' ,
29
16
storage_size : 'number' ,
@@ -32,8 +19,61 @@ var Collection = AmpersandModel.extend({
32
19
padding_factor : 'number' ,
33
20
extent_count : 'number' ,
34
21
extent_last_size : 'number' ,
22
+ /**
23
+ * http://docs.mongodb.org/manual/reference/command/collStats/#collStats.userFlags
24
+ */
35
25
flags_user : 'number' ,
36
- flags_system : 'number'
26
+ flags_system : 'number' ,
27
+ /**
28
+ * Is this a capped collection?
29
+ */
30
+ capped : {
31
+ type : 'boolean' ,
32
+ default : false
33
+ } ,
34
+ /**
35
+ * Is this collection using power of 2 allocation?
36
+ *
37
+ * http://docs.mongodb.org/manual/core/storage/#power-of-2-allocation
38
+ */
39
+ power_of_two : {
40
+ type : 'boolean' ,
41
+ default : true
42
+ } ,
43
+ /**
44
+ * The total size in memory of all records in a collection. This value does
45
+ * not include the record header, which is 16 bytes per record, but does
46
+ * include the record’s padding. Additionally size does not include the
47
+ * size of any indexes associated with the collection, which the
48
+ * totalIndexSize field reports..
49
+ *
50
+ * http://docs.mongodb.org/manual/reference/command/collStats/#collStats.size
51
+ */
52
+ size : 'number' ,
53
+ /**
54
+ * New in version 3.0.0.
55
+ *
56
+ * A document that reports data from the storage engine for each index
57
+ * in the collection.
58
+ *
59
+ * The fields in this document are the names of the indexes, while the
60
+ * values themselves are documents that contain statistics for the index
61
+ * provided by the storage engine. These statistics are for
62
+ * internal diagnostic use.
63
+ *
64
+ * http://docs.mongodb.org/manual/reference/command/collStats/#collStats.indexDetails
65
+ */
66
+ index_details : 'object' ,
67
+ /**
68
+ * New in version 3.0.0.
69
+ *
70
+ * wiredTiger only appears when using the wiredTiger storage engine. This
71
+ * document contains data reported directly by the WiredTiger engine and
72
+ * other data for internal diagnostic use.
73
+ *
74
+ * http://docs.mongodb.org/manual/reference/command/collStats/#collStats.wiredTiger
75
+ */
76
+ wired_tiger : 'object'
37
77
} ,
38
78
collections : {
39
79
indexes : IndexCollection
0 commit comments