samedi 19 décembre 2015

Query documents array field with Laravel and MongoDB

My MongoDB collection looks something like this:

[
{
    "_id" : ObjectId("5674f03320f5747dc975a71a"),
    "id" : 1,
    "tags" : ["Laravel", "PHP", "MySQL"]
},
{
    "_id" : ObjectId("5674f03320f5747dc975a71b"),
    "id" : 2,
    "tags" : ["HTML 5", "CSS 3", "jQuery"]
},
{
    "_id" : ObjectId("5674f03320f5747dc975a71c"),
    "id" : 3,
    "tags" : ["Laravel", "HTML 5", "CSS 3", "Twittwer Bootstrap"]
}
]

I'm trying to find a way to select records that has the tags "HTML 5" and "CSS 3". The documentation doesn't seem to show how to do such.

Anyone here knows how to do it?

Thanks in advanced.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire