php - MongoDB equivalent of "NOT BETWEEN" -


I am using MongoDB, PHP driver, and Google Maps. Since Google maps wrap-around for longitude (in some cases it may be larger than the right latitude), I try to get the equivalent of not less of MySQL working in Mangaodbi I am doing / P>

Has anyone successfully used the MongoDB "$ or" operator, which is not the opposite?

Even my (unsuccessful) attempt is:

  // If (if $ longitude_left & gt; $ longitude_right) {$ parame = array ('$') Or '= & gt; array (' latitude '= & gt; array (' $ gte '=> $ longitude_left,' $ lte '= & gt; $ longitude_right)); } By default, the right longitude is greater than {$ params = array ('latitude' = & gt; array ('$ gte' = & gt; $ longitude_left, '$ lte' = & gt; $ longitude_right) ); } $ Mongo = new mongo (); $ Cursor = $ Mongo-> Energy-> Plant-> Search ($ params);    

MPodi's PHP driver always accepts ARAC / hopes ... < / P>

Since you are passing the arrows for $ gte and $ lte ... Both will be $ or To work correctly

In your example, you pass the first part in an array, but there is no array for $ or and < Strong> $ gte and $ Lte ...

For your example of working, you do something Will ...

  $ params = array ('$ array (' $ lte '= & gt; $ longitude_left)) or' = & gt; Array (array ('longitude' => array ('$ gte' => $ longitude_left)), array ('latitude' = & gt;)); $ Cursor = $ Collection-> Find ($ params);    

Comments