Skip to content

Instantly share code, notes, and snippets.

@darkredz
Created July 20, 2012 17:49
Show Gist options
  • Select an option

  • Save darkredz/3152203 to your computer and use it in GitHub Desktop.

Select an option

Save darkredz/3152203 to your computer and use it in GitHub Desktop.
JS expression query in MongoDB with DooPHP
<?php
//this would be slow to find case insensitive category
$categoryInput = strtolower($postedFromSomeWhere);
$categoryModel = new Category;
$rs = $categoryModel->findOne(
'$where' => 'this.category.toLowerCase()=="'. $categoryInput .'" && this.username=="leng"'
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment