@Override
public void updateAssociation(Association association, AssociationKey key, AssociationContext associationContext) {
DBCollection collection;
DBObject query;
MongoDBAssociationSnapshot assocSnapshot = (MongoDBAssociationSnapshot) association.getSnapshot();
String associationField;
AssociationStorageStrategy storageStrategy = getAssociationStorageStrategy( key, associationContext );
WriteConcern writeConcern = getWriteConcern( associationContext );
// We need to execute the previous operations first or it won't be able to find the key that should have
// been created
executeBatch( associationContext.getOperationsQueue() );
if ( storageStrategy == AssociationStorageStrategy.IN_ENTITY ) {
collection = this.getCollection( key.getEntityKey() );
query = this.prepareIdObject( key.getEntityKey() );
associationField = key.getCollectionRole();
}
else {
collection = getAssociationCollection( key, storageStrategy );
query = assocSnapshot.getQueryObject();
associationField = ROWS_FIELDNAME;
}
List<?> rows = getAssociationRows( association, key );