Created
June 29, 2010 06:47
-
-
Save kidsil/456879 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
So, you want to search in your MongoDB? | |
Here's how to do so | |
'puki' is my collection, for normal people it would be articles, pages or whatever | |
$query is what I'm searching for, here I have inside puki a body and name, | |
I want to retrieve pukis that have $query in their name or body | |
$db = MangoDB::instance(); | |
$puki = $db->find('puki', array( | |
new MongoCode("function() { return (/$query/i.test(this.body) || (/$query/i.test(this.name))}") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment