build: refactor utility functions and meta script
db.version() works for the mongos process as well

Signed-off-by: Sam Kleinman <samk@10gen.com>
Sort must use on cursor, after find function

Signed-off-by: Sam Kleinman <samk@10gen.com>