mongodb: finding the highest numeric value of a column

前端 未结 4 933
闹比i
闹比i 2020-12-19 06:34

I have MongoDB collection of documents containing several fields. One of the columns/fields should be numeric only, but some of these fields contain non-numerical (corrupt)

4条回答
  •  青春惊慌失措
    2020-12-19 07:15

    This works for me

    $options = ['limit' => 100,'skip' => 0, 'projection' => ['score' => ['$meta' => 'textScore']], 'sort' => ['score' => ['$meta' => 'textScore']]];
    

提交回复
热议问题