Explanation of Write-concern in MongoDB in spirng

Source: Internet
Author: User

Spring does not return a status configuration when inserting a database: Write-concern get exception
<beans xmlns= "Http://www.springframework.org/schema/beans" xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance "xmlns:mongo=" Http://www.springframework.org/schema/data/mongo "xsi:schemalocation="/HTTP/ Www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd HTTP://WWW.S Pringframework.org/schema/data/mongo http://www.springframework.org/schema/data/mongo/spring-mongo.xsd ">< !--Configure Spring-data Connection MONGO Mongotemplate-<!--first list the level parameters of the Writeconcern that throw the exception: Writeconcern.none: no exception thrown Writeconcern.normal: Throw only network error exception, no server error exception Writeconcern.safe: Throw network error exception, server error exception, and wait for the server to complete the write operation. Writeconcern.majority: Throws a network error exception, server error exception, and waits for a master server to complete the write operation. Writeconcern.fsync_safe: Throws network error exception, server error exception, write operation waits for server to flush data to disk. Writeconcern.journal_safe: Throws a network error exception, a server error exception, and a write operation waits for the server to submit a log file to disk. Writeconcern.replicas_safe: Throws a network error exception, server error exception, wait for at least 2 servers to complete the write operation. --><mongo:mongo-client replica-set= "${im.mongodb.replica.set}" ><moNgo:client-options write-concern= "NORMAL"/></mongo:mongo-client><!--Mongo template class instance--><bean id= " Mongotemplate "class=" org.springframework.data.mongodb.core.MongoTemplate "><constructor-arg ref=" MONGO "/ ><constructor-arg name= "DatabaseName" value= "${im.mongodb.name}"/></bean>

Explanation of Write-concern in MongoDB in spirng

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.