Doctrine Mongo ODM - select distinct values

954 views Asked by At

I need to select distinct values from a mongoDB collection. As is described in docs here for this can be used "distinct". But it returns only the fields that was used in distinct condition (ArrayIterator object), not as loggable cursor object:

    object(Doctrine\MongoDB\ArrayIterator)[1072]
  private 'elements' => 
    array (size=2)
      0 => int 39
      1 => int 47
  private 'commandResult' => 
    array (size=3)
      'values' => 
        array (size=2)
          0 => int 39
          1 => int 47
      'stats' => 
        array (size=5)
          'n' => int 60
          'nscanned' => int 71
          'nscannedObjects' => int 71
          'timems' => int 0
          'cursor' => string 'BasicCursor' (length=11)
      'ok' => float 1
0

There are 0 answers