MongoDB --- nowritehasbeendoneonthisconnection Solution

Source: Internet
Author: User
This problem has occurred for several days. The log contains dozens of nowritehasbeendoneonthisconnection times a day. The operation done by the program is to throw getLastError when a problem occurs, and then check the getLastError method. W has several values. 1: After writing the Code, any server can proceed to the next step.

This problem has occurred for several days. The log contains dozens of no write has been done on this connection times a day, so it has been studied for several days. The operation done by the program is to throw getLastError when a problem occurs, and then check the getLastError method. W has several values. 1: After writing the Code, any server can proceed to the next step.

This problem has occurred for several days. The log contains dozens of times of no write has been done on this connection,

So I studied it for several days.

The operation done by the program is to throw getLastError when a problem occurs.

Then I checked the getLastError method. W has several values,

1: Any server can perform the next step after writing the script.

2: two instances are required.

0: The write operation is continued, regardless of whether the write is completed or not.

Another value is majority. After reading the official documentation, I understand that majority is used for values greater than 2. The following is an official explanation

The above is an official explanation of several parameters.

Another value is j, true, false, and true to enable logging.

For example, w: 1, j: true, you must write the write operation to journal on a server before proceeding to the next step.

As shown in the figure, you must finish writing journal to return a valid value.

From the red line, we can see that majority will replace a number greater than 2,

Return to the question, report the error, and find the version problem. We can verify by using the following method: On 2.2, remove an empty set, and then immediately enter getLastError (w: 1) To return the question error, but on 2.6, no.

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.