File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -416,6 +416,16 @@ describe('e2e', function() {
416
416
shell . assertContainsOutput ( "{ _id: 'xyz', totalSaleAmount: 150 }" ) ;
417
417
} ) ;
418
418
} ) ;
419
+
420
+ it ( 'treats piping a script into stdin line by line' , async ( ) => {
421
+ // This script doesn't work if evaluated as a whole, only when evaluated
422
+ // line-by-line, due to Automatic Semicolon Insertion (ASI).
423
+ createReadStream ( path . resolve ( __dirname , 'fixtures' , 'asi-script.js' ) )
424
+ . pipe ( shell . process . stdin ) ;
425
+ await eventually ( ( ) => {
426
+ shell . assertContainsOutput ( 'admin;system.version;' ) ;
427
+ } ) ;
428
+ } ) ;
419
429
} ) ;
420
430
421
431
describe ( 'Node.js builtin APIs in the shell' , ( ) => {
Original file line number Diff line number Diff line change
1
+ /* eslint-disable */
2
+ print ( "Database Name;Collection Name;Documents;Documents Size;Documents Avg;Indexes;Index Size;Index Avg" )
3
+ db . getSiblingDB ( 'admin' ) . runCommand ( { listDatabases : 1 , nameOnly : true } ) . databases . forEach ( function ( d ) {
4
+ if ( [ "local" , "config" ] . indexOf ( d . name ) > - 1 ) { return ; }
5
+ var curr_db = db . getSiblingDB ( d . name ) ;
6
+ curr_db . getCollectionNames ( ) . forEach ( function ( coll ) {
7
+ var c = curr_db . getCollection ( coll ) ;
8
+ if ( typeof c != "function" ) {
9
+ print ( d . name + ";" + coll + ";" + c . stats ( ) . count + ";" + c . stats ( ) . size + ";" + c . stats ( ) . avgObjSize + ";" + c . stats ( ) . nindexes + ";" + c . stats ( ) . totalIndexSize + ";" + c . stats ( ) . totalIndexSize / c . stats ( ) . nindexes ) ;
10
+ }
11
+ } ) ;
12
+ } ) ;
You can’t perform that action at this time.
0 commit comments