【问题标题】:SpringData MongoRepository Count and Where clause combinationSpring Data MongoRepository Count 和 Where 子句组合
【发布时间】:2017-12-01 12:53:52
【问题描述】:

我正在使用 MongoDb 和 SpringData MongoRepository.. 我想在接收者用户 = 的地方获取计数消息?和消息阅读=? ... 简而言之,我想获取用户未读的消息。我的方法是这样的..但我不知道如何做到这一点..消息是我的 mongo 文档..谢谢。

@Repository
public interface MessageRepository extends MongoRepository<Message, Long> {

    Long countByReadedWhereReceiverIs(boolean readed,String receiver);

}

【问题讨论】:

    标签: spring-data mongorepository


    【解决方案1】:

    答案是

    int countFindByReadedAndReceiver(boolean readed, String receiver);
    

    【讨论】:

      猜你喜欢
      • 2020-01-30
      • 2017-01-18
      • 2015-08-23
      • 2020-06-19
      • 1970-01-01
      • 2012-12-16
      • 1970-01-01
      • 2019-12-23
      • 2021-12-24
      相关资源
      最近更新 更多