Question: I'm having a bit of trouble sending my data to my controller through the ajax request I'm using. 

Currently in my view, I have 

```
 <p>Please enter your email and phone number registered with the account</p>
   <table id="Table">
    <tr>
        <td>Email</td>
        <td> <input id = "email" type ="text" name= "email" /></td>
    </tr>
    <tr>
        <td>Phone Number</td>
        <td> <input id = "phone" type ="text" name= "phone" /></td>
    </tr>
</table>

<input type="button" value="Submit" id="sendMSG">

```

and the following script

```
<script src="http://code.jquery.com/jquery-1.9.1.js">
        </script>

<script>
$("#sendMSG").click(function () {
    $.ajax({
        type: "POST",
        url: '@Url.Action("SendMessage", "SMSTest")',
        dataType: "JSon",
        data: { "email": $("#email").toString(), "phone": $("#phone").toString()},
        success: function (data) {
            console.log(data);
        },
        error: console.log("it did not work"),
    });
});
</script>

```

When I call the function, I send it to my `SMSTestController` 

```
 public JsonResult SendMessage(string email, string phone)
        {}

```

what I currently get as the email and phone are the values `[object Object]` which is a type string for both my email and phone after clicking the button.

do you have any idea on how to send the actual string I enter in the textbox directly to the controller?

Thanks

Answer: 
The solution is:

```
  $m = new Mongo();
  $collection = $m->selectDB('production')->selectCollection("centers");
  $array = array('_id' => new MongoId('516d3ae30074d35600000001'));
  $project = array(
    'locations' => array(
      '$elemMatch' => array('id' =>  new MongoId('51b595eabe55b59630000000'))
     )
   );

    $cursor = $collection->find($array, $project);
    foreach ($cursor as $doc) {
        print_r($doc);
    }

```

As Alex lib goes: you need to put $project array in select method not in where
Based on the documentation in his repo, does this not work for you:

```
$this->mongo_db
->where(array(
    '_id' => ObjectId('516d3ae30074d35600000001'),
    'locations' => array( '$elemMatch' => array( "id" : ObjectId("51b595eabe55b59630000000") ) )
))
->get('centers');

```

**edit**: I had originally copied this based on the query in your question. Are you sure that the **`id`** property in your `$elemMatch` shouldn't be **`_id`**?