title: how to check validation mongodb id with php
body: <p>i get mongodb id of query string. how to check validation this id? i want if mongodb id not valid redirect to another url</p>
  
  <p>get query string:</p>
  
  <pre><code>    if(count($_GET)&gt;0 &amp;&amp; $_GET['uid']){
  
              //get id from string query
              $query = array("_id" =&gt; new MongoId($_GET
  
  ['uid']));
          $user = DB::findone('users',$query);
  
      }else{
          //redirect if not exist query string
          header('location:'.ADMIN_URL.'/items/forbidden.php');
      }  
  </code></pre>
  
  <p>plz help...
  thanks</p>