PHP & MongoDB: Building a custom query with multiple values per field

Initially, I built a mongo query in php using by using a nested associative array. Then I call:

$collection->find($query, $fields) 

However, I cannot do that as far as I know when there needs to be the same field name repeated at the same level. For example:

{"field1" : "value1", "field1" : "value2"}

Is there another way to structure queries in php, or another way I can write this example query so that I don’t have multiple of the same field in the same level?

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s