examples/mongolian_trainer.js
function fillCollection(collection, max, callback) {
    collection.count(function(err,count) {
        console.log(collection+" count = "+count)
        while (count < max) {
            var toInsert = []
            while (count < max) {
                toInsert.push({ foo: Math.random(), index: count++ })
                if (toInsert.length == 300) {
                    break
                }
            }
            console.log("inserting "+toInsert.length+" document(s) into "+collection)
            collection.insert(toInsert)
        }
        callback()
    })
}
function fillCollection(collection, max, callback) {
    collection.count(function(err,count) {
        console.log(collection+" count = "+count)
        while (count < max) {
            var toInsert = []
            while (count < max) {
                toInsert.push({ foo: Math.random(), index: count++ })
                if (toInsert.length == 300) {
                    break
                }
            }
            console.log("inserting "+toInsert.length+" document(s) into "+collection)
            collection.insert(toInsert)
        }
        callback()
    })
}
function fillCollection ( collection , max , callback ) { collection . count ( function ( err , count ) { console . log ( collection + " count = " + count ) while ( count < max ) { var toInsert = [ ] while ( count < max ) { toInsert . push ( { foo : Math . random ( ) , index : count ++ } ) if ( toInsert . length == 300 ) { break } } console . log ( "inserting " + toInsert . length + " document(s) into " + collection ) collection . insert ( toInsert ) } callback ( ) } ) }
Adds some junk to the database
Adds some junk to the database