MongoDB中的SQL查询等效项>>

问题描述 投票:0回答:1

我在Spring MySql中有此查询:

@Query(value="SELECT if(Count(*) > 0, 'true', 'false') as bool FROM season c WHERE c.archived=0 and c.user_seasons_id=:idUser and :seasondate BETWEEN c.date_debut and c.date_fin",nativeQuery = true) public Boolean existsSeasonDates(@Param ("seasondate") Date seasondate,@Param ("idUser") Long idUser);

我需要使用mongoDB而不是MySql更改@Query的正文。

谢谢。

我在Spring MySql中有此查询:@Query(value =“ SELECT if(Count(*)> 0,'true','false')as as bool FROM season c WHERE c.archived = 0和c.user_seasons_id = :idUser和:seasondate介于c ....

mysql spring mongodb
1个回答
0
投票

我可能应该添加一条注释,从OP请求更多信息,而不是发布答案,但本着试图将该SQL语句转换为等效的MongoDB查询(和数据环境)的精神,此数据:

© www.soinside.com 2019 - 2024. All rights reserved.