original_string: private function createCommandDocument()
      {
          $cmd = ['find' => $this->collectionName, 'filter' => (object) $this->filter];
  
          $options = $this->createQueryOptions();
  
          if (empty($options)) {
              return $cmd;
          }
  
          // maxAwaitTimeMS is a Query level option so should not be considered here
          unset($options['maxAwaitTimeMS']);
  
          $modifierFallback = [
              ['allowPartialResults', 'partial'],
              ['comment', '$comment'],
              ['hint', '$hint'],
              ['maxScan', '$maxScan'],
              ['max', '$max'],
              ['maxTimeMS', '$maxTimeMS'],
              ['min', '$min'],
              ['returnKey', '$returnKey'],
              ['showRecordId', '$showDiskLoc'],
              ['sort', '$orderby'],
              ['snapshot', '$snapshot'],
          ];
  
          foreach ($modifierFallback as $modifier) {
              if ( ! isset($options[$modifier[0]]) && isset($options['modifiers'][$modifier[1]])) {
                  $options[$modifier[0]] = $options['modifiers'][$modifier[1]];
              }
          }
          unset($options['modifiers']);
  
          return $cmd + $options;
      }
code: private function createCommandDocument()
      {
          $cmd = ['find' => $this->collectionName, 'filter' => (object) $this->filter];
  
          $options = $this->createQueryOptions();
  
          if (empty($options)) {
              return $cmd;
          }
  
          // maxAwaitTimeMS is a Query level option so should not be considered here
          unset($options['maxAwaitTimeMS']);
  
          $modifierFallback = [
              ['allowPartialResults', 'partial'],
              ['comment', '$comment'],
              ['hint', '$hint'],
              ['maxScan', '$maxScan'],
              ['max', '$max'],
              ['maxTimeMS', '$maxTimeMS'],
              ['min', '$min'],
              ['returnKey', '$returnKey'],
              ['showRecordId', '$showDiskLoc'],
              ['sort', '$orderby'],
              ['snapshot', '$snapshot'],
          ];
  
          foreach ($modifierFallback as $modifier) {
              if ( ! isset($options[$modifier[0]]) && isset($options['modifiers'][$modifier[1]])) {
                  $options[$modifier[0]] = $options['modifiers'][$modifier[1]];
              }
          }
          unset($options['modifiers']);
  
          return $cmd + $options;
      }
code_tokens: private function createCommandDocument ( ) { $ cmd = [ 'find' => $ this -> collectionName , 'filter' => ( object ) $ this -> filter ] ; $ options = $ this -> createQueryOptions ( ) ; if ( empty ( $ options ) ) { return $ cmd ; } // maxAwaitTimeMS is a Query level option so should not be considered here unset ( $ options [ 'maxAwaitTimeMS' ] ) ; $ modifierFallback = [ [ 'allowPartialResults' , 'partial' ] , [ 'comment' , '$comment' ] , [ 'hint' , '$hint' ] , [ 'maxScan' , '$maxScan' ] , [ 'max' , '$max' ] , [ 'maxTimeMS' , '$maxTimeMS' ] , [ 'min' , '$min' ] , [ 'returnKey' , '$returnKey' ] , [ 'showRecordId' , '$showDiskLoc' ] , [ 'sort' , '$orderby' ] , [ 'snapshot' , '$snapshot' ] , ] ; foreach ( $ modifierFallback as $ modifier ) { if ( ! isset ( $ options [ $ modifier [ 0 ] ] ) && isset ( $ options [ 'modifiers' ] [ $ modifier [ 1 ] ] ) ) { $ options [ $ modifier [ 0 ] ] = $ options [ 'modifiers' ] [ $ modifier [ 1 ] ] ; } } unset ( $ options [ 'modifiers' ] ) ; return $ cmd + $ options ; }
docstring: Construct a command document for Find
docstring_tokens: Construct a command document for Find