Shaggie
Shaggie

Reputation: 1829

mongodb-php: "key" side value for nested querying of find() function doesnot work

I want to retrive record which are matching to booking's client id & want to show it to client. I am doing the following:

$mongoDb = $mongoDb->selectCollection('booking');
$bookingInfo = $mongoDb->find(array("client.id" => $_SESSION['client_id']));

My mongo database record looks like this:

  "paymentDue": "",
  "client": {
  "contacts": [
  {
    "name": "loy furison",
    "email": "[email protected]"
  }
],
"id": "5492abba64363df013000029",
"name": "Birdfire"
},

want to fire the query with key value as client.id in find function. But this query doesnt work..whats the issue

Upvotes: 2

Views: 100

Answers (1)

Shaggie
Shaggie

Reputation: 1829

I got a little logic that is different by key name only. If i find it with client.name then i shows me records & there i need to insert these in json object & then through foreach loop each record if i retrive & compare then it works...got it but the expected doesnt work why?????...didnt get:-!

Upvotes: 1

Related Questions