MongoDB log, (a way to look at the log to solve a new problem)--CLWU

Source: Internet
Author: User
Tags mongodb commands mongodb driver

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.