本文整理了Java中org.springframework.data.mongodb.core.query.Query.getHint
方法的一些代码示例,展示了Query.getHint
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query.getHint
方法的具体详情如下:
包路径:org.springframework.data.mongodb.core.query.Query
类名称:Query
方法名:getHint
暂无
代码示例来源:origin: spring-projects/spring-batch
@Test
public void testHint() throws Exception {
MongoItemReader<String> reader = getBasicBuilder()
.hint("{ $natural : 1}")
.build();
when(this.template.find(this.queryContainer.capture(), eq(String.class))).thenReturn(new ArrayList<>());
assertNull("reader should not return result", reader.read());
Query query = this.queryContainer.getValue();
assertEquals("{ $natural : 1}", query.getHint());
}
代码示例来源:origin: spring-projects/spring-data-mongodb
&& !StringUtils.hasText(query.getHint()) && !meta.hasValues() && !query.getCollation().isPresent()) {
return cursor;
if (StringUtils.hasText(query.getHint())) {
cursorToUse = cursorToUse.hint(Document.parse(query.getHint()));
代码示例来源:origin: spring-projects/spring-batch
@Test
public void testQueryWithHint() {
reader.setHint("{ $natural : 1}");
ArgumentCaptor<Query> queryContainer = ArgumentCaptor.forClass(Query.class);
when(template.find(queryContainer.capture(), eq(String.class))).thenReturn(new ArrayList<>());
assertFalse(reader.doPageRead().hasNext());
Query query = queryContainer.getValue();
assertEquals(50, query.getLimit());
assertEquals(0, query.getSkip());
assertEquals("{ }", query.getQueryObject().toJson());
assertEquals("{ \"name\" : -1 }", query.getSortObject().toJson());
assertEquals("{ $natural : 1}", query.getHint());
}
代码示例来源:origin: spring-projects/spring-data-mongodb
&& !StringUtils.hasText(query.getHint()) && !meta.hasValues()) {
return findPublisherToUse;
if (StringUtils.hasText(query.getHint())) {
findPublisherToUse = findPublisherToUse.hint(Document.parse(query.getHint()));
代码示例来源:origin: org.springframework.data/spring-data-mongodb
&& !StringUtils.hasText(query.getHint()) && !meta.hasValues()) {
return findPublisherToUse;
if (StringUtils.hasText(query.getHint())) {
findPublisherToUse = findPublisherToUse.hint(Document.parse(query.getHint()));
代码示例来源:origin: org.springframework.data/spring-data-mongodb
&& !StringUtils.hasText(query.getHint()) && !meta.hasValues() && !query.getCollation().isPresent()) {
return cursor;
if (StringUtils.hasText(query.getHint())) {
cursorToUse = cursorToUse.hint(Document.parse(query.getHint()));
内容来源于网络,如有侵权,请联系作者删除!