|
|
|
@ -237,11 +237,11 @@ public class MongoTemplate implements InitializingBean { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void update(DBObject queryDoc, DBObject updateDoc) { |
|
|
|
public void updateFirst(DBObject queryDoc, DBObject updateDoc) { |
|
|
|
update(getRequiredDefaultCollectionName(), queryDoc, updateDoc); |
|
|
|
updateFirst(getRequiredDefaultCollectionName(), queryDoc, updateDoc); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void update(String collectionName, DBObject queryDoc, DBObject updateDoc) { |
|
|
|
public void updateFirst(String collectionName, DBObject queryDoc, DBObject updateDoc) { |
|
|
|
WriteResult wr = null; |
|
|
|
WriteResult wr = null; |
|
|
|
try { |
|
|
|
try { |
|
|
|
wr = getDb().getCollection(collectionName).update(queryDoc, updateDoc); |
|
|
|
wr = getDb().getCollection(collectionName).update(queryDoc, updateDoc); |
|
|
|
@ -250,6 +250,19 @@ public class MongoTemplate implements InitializingBean { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void updateMulti(DBObject queryDoc, DBObject updateDoc) { |
|
|
|
|
|
|
|
updateMulti(getRequiredDefaultCollectionName(), queryDoc, updateDoc); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void updateMulti(String collectionName, DBObject queryDoc, DBObject updateDoc) { |
|
|
|
|
|
|
|
WriteResult wr = null; |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
wr = getDb().getCollection(collectionName).updateMulti(queryDoc, updateDoc); |
|
|
|
|
|
|
|
} catch (MongoException e) { |
|
|
|
|
|
|
|
throw new DataRetrievalFailureException("Error during updateMulti using " + queryDoc + ", " + updateDoc + ": " + wr.getLastError().getErrorMessage(), e); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void remove(DBObject queryDoc) { |
|
|
|
public void remove(DBObject queryDoc) { |
|
|
|
remove(getRequiredDefaultCollectionName(), queryDoc); |
|
|
|
remove(getRequiredDefaultCollectionName(), queryDoc); |
|
|
|
} |
|
|
|
} |
|
|
|
|