Interface MessageRepository

  • All Superinterfaces:
    org.springframework.data.repository.CrudRepository<Message,​java.lang.String>, org.springframework.data.mongodb.repository.MongoRepository<Message,​java.lang.String>, org.springframework.data.repository.PagingAndSortingRepository<Message,​java.lang.String>, org.springframework.data.repository.query.QueryByExampleExecutor<Message>, org.springframework.data.repository.Repository<Message,​java.lang.String>

    @Repository
    public interface MessageRepository
    extends org.springframework.data.mongodb.repository.MongoRepository<Message,​java.lang.String>
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      java.lang.Long countMessagesByChatId​(java.lang.String chatId)  
      java.util.List<Message> findByChatId​(java.lang.String chatId)  
      org.springframework.data.domain.Page<Message> findByChatId​(java.lang.String chatId, org.springframework.data.domain.Pageable page)  
      java.util.List<Message> findInboxUnreadByChatId​(java.lang.String chatId, java.lang.String toId)  
      java.util.List<Message> findUnreadByChatId​(java.lang.String chatId)  
      • Methods inherited from interface org.springframework.data.repository.CrudRepository

        count, delete, deleteAll, deleteAll, deleteAllById, deleteById, existsById, findAllById, findById, save
      • Methods inherited from interface org.springframework.data.mongodb.repository.MongoRepository

        findAll, findAll, findAll, findAll, insert, insert, saveAll
      • Methods inherited from interface org.springframework.data.repository.PagingAndSortingRepository

        findAll
      • Methods inherited from interface org.springframework.data.repository.query.QueryByExampleExecutor

        count, exists, findAll, findBy, findOne
    • Method Detail

      • findByChatId

        @Query("{ \'embeddedChat._id\' : ?0 }")
        java.util.List<Message> findByChatId​(java.lang.String chatId)
      • countMessagesByChatId

        @Query(value="{ \'embeddedChat._id\' : ?0 }",
               count=true)
        java.lang.Long countMessagesByChatId​(java.lang.String chatId)
      • findByChatId

        @Query("{ \'embeddedChat._id\' : ?0 }")
        org.springframework.data.domain.Page<Message> findByChatId​(java.lang.String chatId,
                                                                   org.springframework.data.domain.Pageable page)
      • findUnreadByChatId

        @Query("{ \'embeddedChat._id\' : ?0 , messageState : \'UNREAD\' }")
        java.util.List<Message> findUnreadByChatId​(java.lang.String chatId)
      • findInboxUnreadByChatId

        @Query("{ \'embeddedChat._id\' : ?0 , \'to.$id\' : ?1 , messageState : \'UNREAD\' }")
        java.util.List<Message> findInboxUnreadByChatId​(java.lang.String chatId,
                                                        java.lang.String toId)