sune brodersen
unread,Aug 31, 2010, 4:38:21 PM8/31/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to mongodb-user
Hi,
Im new to Mongo, and facing a problem in searching. Im using php and
inserting the following document:
$doc = array('firstname'=>'sune',
'clicks'=>array(array('url'=>'blabla','tstamp'=>33235435334543),array('url'=>'blabla2','tstamp'=>4536546456)));
$col->insert($doc);
This works fine. And if i search for specifik url like this:
$col-
>find(array('clickstrem.url'=>'blabla','clickstream.tstamp'=>33235435334543)
it returns the doc from above. This is all fine. But if i search like
this:
$col->find(array('clicks.url'=>'blabla','clicks.tstamp'=>4536546456)
it also returns the doc from above. It kind of make sense, since the
first entry in the embedded doc has url=>blabla, and the second entry
has tstamp=>4536546456
But what im looking for is a way to search for docs that includes
url=blabla and tstamp=4536546456 in the same entry in the embedded
doc.
Hope it makes sense :)
BR/Sune