I need help with finding distinct values but I also need to give a filter condition.
I have managed the distinct in this fashion :
$unique = $db->command(array("distinct" => "employee", "key" => "name"));
How do I add the “where age = “25” ” clause to this?
Thanks for you help!
distinct()in the MongoDB shell, and thedistinctcommand both take aqueryargument which is used to filter the set of records to consider when determining distinct key values. In your example, you could do:in the MongoDB shell, or:
in PHP.