coen-hyde/Shanty-Mongo — Issue #49: Array Element by Position ?
Author: zapatista
Created: 2011-10-30 16:55:14+00:00
State: open

i've a data :
"relatedItem" : { "0" : { "itemGuid" : "10" }, {"1" : {"itemGuid" : "20" }

I tried:
- $catalog->relatedItem->find(array('itemGuid':'20')); and get the error message:
Error:Shanty_Mongo_DocumentSet::$_collection is null
- $catalog->find(array('relatedItem' => array('$elemMatch' => array('itemGuid': '20'))));
null
- $catalog->find(array('relatedItem' => array(array('itemGuid': '20'))));
null
- $catalog->find(array('relatedItem.1.itemGuid'=>'20'));
20 ----> it's not a standard query syntax

how to match an entire document within the relatedItem array ?

thanks, I appreciate the quick response