I have an object that has an array of sub objects on it:
_id: "9",
clients: [
{
id: 677,
enabled: true,
updated: 0,
created: 1352416600
},
{
id: 668,
enabled: true,
updated: 0,
created: 1352416600
}
],
cloud: false,
name: "love",
}
The user makes a request for images with client id 677, the above object will be returned
The user makes a request for images with client ids 677 and 668, the image above is returned
The user makes a request for images with client ids 677, 668, 690, the above image isn't returned
Im using PHP and Mongo DB. The MYSQL query that used to power this used to use a COUNT and sub query.
I have no idea where to even start tackling this in Mongo.
Any help appreciated.