Mongodb - logical operators e.g. "$lt" "$lte" - but is there one for '=' to simplify programming
Jimmy Sawczuk gave a great help going forward, but also inspired me to look into "$in" for using it as an equal '=' operator, but it might not be possible...

I have this code which I would like to make more nice (know it looks complicated (so skip it) but I will get to the point soon and then it might not be that complicated:

    // First html drop down selection / filter selection
    if ($key[0] <> "") {
       if ($op[0] == "=") $query = array($key[0] => $val[0]);
       else $query = array( $key[0] => array( $op[0] => $val[0] ) );
    }   
    else return($query);
    // Second html drop down selection / filter selection
    if ($key[1] <> "") {
       if ($op[1] == "=")  $query = array( $log[0] => array( array($key[1] => $val[1]), $query));
       else $query = array( $log[0] => array( array( $key[1] => array( $op[1] => $val[1] ) ), $query) );
    }   
    else return($query);

What I would like to do is to simplify the code (for simplicity I have merged key0 and key1 lines):

    if ($key[1] <> "")  $query = array( $log[0] => array( array( $key[1] => array( $op[1] => $val[1] ) ), array( $key[0] => array( $op[0] => $val[0] ) )) );
    
    $log: logical operater: "$and", "$or"
    $key: key in database
    $val: value to be matched against
    $op:  operater e.g. "$lt", "$gt", "$lte", "$gte", "$ne" all supported by Mongo.

Now my problem is that I would like to have a $op which was '$=' or a bit like $in. However $in seems to match the same key for several values, but in my case the keys could be different. Having a '$=' like operator in mongo would highly simplify my programming. I have read several turorials but can not find such a operator. I find it is strange as when you have $ne (not equal) why then not having equal. Have I missed something, is there a workaround (well I do workaround now but it looks ugly) or does $= exist ?

Thanks!
Mongodb - logical operators e.g. "$lt" "$lte" - but is there one for '=' to simplify programming
===

Jimmy Sawczuk gave a great help going forward, but also inspired me to look into "$in" for using it as an equal '=' operator, but it might not be possible...

I have this code which I would like to make more nice (know it looks complicated (so skip it) but I will get to the point soon and then it might not be that complicated:

    // First html drop down selection / filter selection
    if ($key[0] <> "") {
       if ($op[0] == "=") $query = array($key[0] => $val[0]);
       else $query = array( $key[0] => array( $op[0] => $val[0] ) );
    }   
    else return($query);
    // Second html drop down selection / filter selection
    if ($key[1] <> "") {
       if ($op[1] == "=")  $query = array( $log[0] => array( array($key[1] => $val[1]), $query));
       else $query = array( $log[0] => array( array( $key[1] => array( $op[1] => $val[1] ) ), $query) );
    }   
    else return($query);

What I would like to do is to simplify the code (for simplicity I have merged key0 and key1 lines):

    if ($key[1] <> "")  $query = array( $log[0] => array( array( $key[1] => array( $op[1] => $val[1] ) ), array( $key[0] => array( $op[0] => $val[0] ) )) );
    
    $log: logical operater: "$and", "$or"
    $key: key in database
    $val: value to be matched against
    $op:  operater e.g. "$lt", "$gt", "$lte", "$gte", "$ne" all supported by Mongo.

Now my problem is that I would like to have a $op which was '$=' or a bit like $in. However $in seems to match the same key for several values, but in my case the keys could be different. Having a '$=' like operator in mongo would highly simplify my programming. I have read several turorials but can not find such a operator. I find it is strange as when you have $ne (not equal) why then not having equal. Have I missed something, is there a workaround (well I do workaround now but it looks ugly) or does $= exist ?

Thanks!