org.springframework.data.mongodb.core.query.Query.getHint()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(2.5k)|赞(0)|评价(0)|浏览(229)

本文整理了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

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()));

相关文章