调用 MongoDB 存储库接口的方法时出现 StackOverflowError:
public interface TermRepository extends MongoRepository<Term, String>, QuerydslPredicateExecutor<Term> {
// [...]
@Query("{$or:[{'apis' : {$in : ?0 } }, {$text:{$search:?1}}]}")
Page<Term> globalSearch(List<DBRef> apis, String searchKeyword, Pageable pageable);
}
Run Code Online (Sandbox Code Playgroud)
apis
是一个只有一个 DBRef 的列表: new DBRef("api", new ObjectId("5e3ad9faaafa595898b6a682"))
searchKeyword
等于“账户”
pageable
是Page request [number: 0, size 37, sort: UNSORTED]
。如果size
是 36,它不会抛出 StackOverflowError!{
$or: [{
'apis': {
$in: [{
'$ref': 'api',
'$id': ObjectId('5e3ad9faaafa595898b6a682')
}]
}
}, {
$text: {
$search: 'account'
}
}]
}
Run Code Online (Sandbox Code Playgroud)