Javascript function not woking properly in mongoDb using php
===

Here My code,

    <?php

        $dbName = "XYZ";
        try
        {
                $dbInstanceName = $dbName;
                $mongoInstance  = new Mongo("localhost:27017", array("persist"    => "x"));
                $dbReference = $mongoInstance->$dbInstanceName;
                $db          = $mongoInstance->$dbInstanceName;
        }
        catch (Exception $e)
        {
                echo "<pre>";
                print_r($e);
                echo "</pre>";
                exit;
        }
        
        $query  = new MongoCode("function (){return RegExp(this.regCountry).test('India');}");
        
        $c = "Countries";

        $cursor = $db->$c->find($query);


        if ($cursor->count() == 0)
        {
                echo "<pre>";
                print_r("No Data Found.!");
                echo "</pre>";
                exit;
        }
        else
        {
                
                $data = array();
                while ($cursor->hasNext())
                {
                        $cursor->next();
                        array_push($data, $cursor->current());
                }                
        }
        echo "<pre>";
        print_r($data);
        echo "</pre>";
        exit;
?>

its working but return nothing....!

resonse : 

    Array
    (
        
    )


here, consoled screen sort, its given return a value.

![enter image description here][1]


here my data sample :

![enter image description here][2]


Please Help,
And Thanks in Advance...!


  [1]: http://i.stack.imgur.com/iy5V7.png
  [2]: http://i.stack.imgur.com/fmMlm.png