Skip to content

Commit

Permalink
chore[orm]: log
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysunxiao committed Jul 29, 2024
1 parent 90cb1b0 commit c91e4f6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions orm/src/main/java/com/zfoo/orm/accessor/MongodbAccessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public <PK extends Comparable<PK>, E extends IEntity<PK>> boolean update(E entit

var result = collection.replaceOne(filter, entity);
if (result.getMatchedCount() <= 0) {
// 数据库中没有这个id或者需要更新的数据和数据库中的相同
logger.warn("database:[{}] 1.[_id:{}] not exist or 2. update entity is equal with database entity", entityClazz.getSimpleName(), entity.id());
// 数据库中没有这个id
logger.warn("database:[{}] [_id:{}] not exist", entityClazz.getSimpleName(), entity.id());
return false;
}
return true;
Expand All @@ -93,8 +93,8 @@ public <PK extends Comparable<PK>, E extends IEntity<PK>> void batchUpdate(List<

var result = collection.bulkWrite(batchList, new BulkWriteOptions().ordered(false));
if (result.getMatchedCount() != entities.size()) {
// 在数据库的批量更新操作中需要更新的数量和最终更新的数量不相同(大部分原因都是因为需要更新的文档和数据库的文档相同)
logger.warn("database:[{}] update size:[{}] not equal with matched size:[{}](Most of the reasons is that update entity is equal with database entity)"
// 在数据库的批量更新操作中需要更新的数量和最终更新的数量不相同
logger.warn("database:[{}] update size:[{}] not equal with matched size:[{}](some entity of id not exist in database)"
, entityClazz.getSimpleName(), entities.size(), result.getMatchedCount());
}
} catch (Throwable t) {
Expand Down

0 comments on commit c91e4f6

Please sign in to comment.