Skip to content

Instantly share code, notes, and snippets.

@ssx
Created November 5, 2010 16:37
Show Gist options
  • Save ssx/664411 to your computer and use it in GitHub Desktop.
Save ssx/664411 to your computer and use it in GitHub Desktop.
<?
$m = new Mongo();
$h = $m->user->users;
$artist = "Linkin Park";
// lastfm_band_0, lastfm_band_1 or lastfm_band_2 may contain $artist
// I need to get the number of documents where this is the case
$x = $h->find(array("lastfm_band_0" => $artist,
'$or' => array(
array("lastfm_band_1" => $artist),
array("lastfm_band_2" => $artist)
))
)->count();
echo var_dump($x);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment