PHP MongoDB - Use of the aggregate command without the cursor option is deprecated. What?

前端 未结 6 728
醉话见心
醉话见心 2020-12-16 20:32

I have updated mongo and now in the log the following error appears: Use of the aggregate command without the cursor option is deprecated

Mo

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-16 21:01

    From the latest MongoDB manual the aggregate operation have changed.

    aggregate without cursor

    MongoDB 3.4 deprecates the use of aggregate command without the cursor option, unless the pipeline includes the explain option. When returning aggregation results inline using the aggregate command, specify the cursor option using the default batch size cursor: {} or specify the batch size in the cursor option cursor: { batchSize: }.

    You can just specify that parameter for your function call with adding [ "cursor" => [ "batchSize" => 0 ] ] as the second parameter will solve this. refer here.

    You can also refer to this SO question for the cursor parameter usage.

提交回复
热议问题