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');
1313var es = require ( 'event-stream' ) ;
1414var Schema = require ( 'mongodb-schema' ) . Schema ;
1515
16+ // Yay! Use the API from the devtools console.
1617window . scout = client ;
1718
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+
1826var wrapError = require ( './wrap-error' ) ;
1927
2028/**
@@ -36,10 +44,15 @@ var SampledSchema = Schema.extend({
3644 wrapError ( this , options ) ;
3745
3846 var model = this ;
47+ window . schema = this ;
48+ window . data = [ ] ;
3949 var parser = this . stream ( )
4050 . on ( 'error' , function ( err ) {
4151 options . error ( err , 'error' , err . message ) ;
4252 } )
53+ . on ( 'data' , function ( doc ) {
54+ window . data . push ( doc ) ;
55+ } )
4356 . on ( 'end' , function ( ) {
4457 process . nextTick ( function ( ) {
4558 model . trigger ( 'sync' , model , model . serialize ( ) , options ) ;
You can’t perform that action at this time.
0 commit comments