Here is a simple connection function :)
<?php
function MongoConnect($username, $password, $database, $host) {
$con = new Mongo("mongodb://{$username}:{$password}@{$host}"); // Connect to Mongo Server
$db = $con->selectDB($database); // Connect to Database
}
?>