From ea001c6a3842ecfdb3022faaaf41028ee60d08bd Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Thu, 13 Dec 2018 12:12:47 -0800 Subject: [PATCH] fixed: write consistency --- manipmongo/manipulator.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/manipmongo/manipulator.go b/manipmongo/manipulator.go index b8876fef..1820072c 100644 --- a/manipmongo/manipulator.go +++ b/manipmongo/manipulator.go @@ -442,15 +442,12 @@ func (s *mongoManipulator) makeSession( ) (*mgo.Collection, func()) { session := s.rootSession.Copy() - mrc := convertReadConsistency(readConsistency) - if mrc != -1 { + + if mrc := convertReadConsistency(readConsistency); mrc != -1 { session.SetMode(mrc, true) } - mwc := convertWriteConsistency(writeConsistency) - if mrc != -1 { - session.SetSafe(mwc) - } + session.SetSafe(convertWriteConsistency(writeConsistency)) return session.DB(s.dbName).C(identity.Name), session.Close }