|
|
|
@ -833,11 +833,10 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, |
|
|
|
|
|
|
|
|
|
|
|
protected <T> void doInsert(String collectionName, T objectToSave, MongoWriter<T> writer) { |
|
|
|
protected <T> void doInsert(String collectionName, T objectToSave, MongoWriter<T> writer) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
initializeVersionProperty(objectToSave); |
|
|
|
maybeEmitEvent(new BeforeConvertEvent<T>(objectToSave, collectionName)); |
|
|
|
maybeEmitEvent(new BeforeConvertEvent<T>(objectToSave, collectionName)); |
|
|
|
assertUpdateableIdIfNotSet(objectToSave); |
|
|
|
assertUpdateableIdIfNotSet(objectToSave); |
|
|
|
|
|
|
|
|
|
|
|
initializeVersionProperty(objectToSave); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Document dbDoc = toDocument(objectToSave, writer); |
|
|
|
Document dbDoc = toDocument(objectToSave, writer); |
|
|
|
|
|
|
|
|
|
|
|
maybeEmitEvent(new BeforeSaveEvent<T>(objectToSave, dbDoc, collectionName)); |
|
|
|
maybeEmitEvent(new BeforeSaveEvent<T>(objectToSave, dbDoc, collectionName)); |
|
|
|
@ -940,8 +939,8 @@ public class MongoTemplate implements MongoOperations, ApplicationContextAware, |
|
|
|
for (T o : batchToSave) { |
|
|
|
for (T o : batchToSave) { |
|
|
|
|
|
|
|
|
|
|
|
initializeVersionProperty(o); |
|
|
|
initializeVersionProperty(o); |
|
|
|
|
|
|
|
|
|
|
|
maybeEmitEvent(new BeforeConvertEvent<T>(o, collectionName)); |
|
|
|
maybeEmitEvent(new BeforeConvertEvent<T>(o, collectionName)); |
|
|
|
|
|
|
|
|
|
|
|
Document document = toDocument(o, writer); |
|
|
|
Document document = toDocument(o, writer); |
|
|
|
|
|
|
|
|
|
|
|
maybeEmitEvent(new BeforeSaveEvent<T>(o, document, collectionName)); |
|
|
|
maybeEmitEvent(new BeforeSaveEvent<T>(o, document, collectionName)); |
|
|
|
|