The project has been replaced with PHP's latest MongoDB driver, but this driver is only a layer of native interface packaging, some commands even to use executecommand construction, like the following aggregate method.
The first package INFRASTRUCTURE\MONGODB after the aggregate code is as follows, I do not know how to write, the internet did not find the use of ExecuteCommand structure aggregate should be how to pass parameters,
This is the client code that calls the encapsulated aggregate function, and it should look right, mimicking the MONGO console aggregate command.
Of course, the execution of the error, throws the following exception, do not know what it said.
Then look at how the problem happened (what did you do?). ), first look at the log, see the log, MongoDB executes the following commands, and parameters
In the right way, trigger a bit and look at the commands and parameters that MongoDB executes.
The commands executed on the MONGO console are, of course, correct.
This time through the log to see the implementation of MONGODB commands and parameters, originally, the different stages of the operand is assigned to the pipeline property, aggregate property is passed CollectionName
After the second change the code is as follows, the positive solution runs.
When you do not know how to solve the problem, you can first explore how the problem occurs.
MongoDB log, (a way to look at the log to solve a new problem)--CLWU