File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,16 @@ var _ = require('underscore');
13
13
var es = require ( 'event-stream' ) ;
14
14
var Schema = require ( 'mongodb-schema' ) . Schema ;
15
15
16
+ // Yay! Use the API from the devtools console.
16
17
window . scout = client ;
17
18
19
+ // Handy debugging! Just type `data` in the devtools console to see the array
20
+ // of documents currently in the schema.
21
+ window . data = [ ] ;
22
+
23
+ // The currently active schema.
24
+ window . schema = null ;
25
+
18
26
var wrapError = require ( './wrap-error' ) ;
19
27
20
28
/**
@@ -36,10 +44,15 @@ var SampledSchema = Schema.extend({
36
44
wrapError ( this , options ) ;
37
45
38
46
var model = this ;
47
+ window . schema = this ;
48
+ window . data = [ ] ;
39
49
var parser = this . stream ( )
40
50
. on ( 'error' , function ( err ) {
41
51
options . error ( err , 'error' , err . message ) ;
42
52
} )
53
+ . on ( 'data' , function ( doc ) {
54
+ window . data . push ( doc ) ;
55
+ } )
43
56
. on ( 'end' , function ( ) {
44
57
process . nextTick ( function ( ) {
45
58
model . trigger ( 'sync' , model , model . serialize ( ) , options ) ;
You can’t perform that action at this time.
0 commit comments