首页 > 解决方案 > readStartDocument 只能在 CurrentBSONType 为 DOCUMENT 时调用,不能在 CurrentBSONType 为 STRING 时调用 错误?

问题描述

我的代码如下所示,我应该怎么做才能避免这个错误?

@RequestMapping(method = RequestMethod.POST, path = "/deneme", consumes = "application/json")
public void logout(@RequestBody Map<String, Object> userId) {
    tokensService.logout(userId.get("userId").toString());
}
public void logout(String userId){
    try {
        tokensRepository.logout(userId,"");

    }
    catch (Exception e) {
        System.out.println(e.getMessage());
    }`public interface TokensRepository extends MongoRepository<Tokens, String> {

@Query("Update tokens t set t.token=:token where t._id=:userId")
void logout(@Param("userId") String userId, @Param("token") String token);

}`

标签: stringspring-bootdocumentbson

解决方案


推荐阅读