org.springframework.data.mongodb.repository.Query类的使用及代码示例

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

本文整理了Java中org.springframework.data.mongodb.repository.Query类的一些代码示例,展示了Query类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Query类的具体详情如下:
包路径:org.springframework.data.mongodb.repository.Query
类名称:Query

Query介绍

暂无

代码示例

代码示例来源:origin: sqshq/piggymetrics

  1. @Query("{ $and: [ {'scheduledNotifications.BACKUP.active': true }, { $where: 'this.scheduledNotifications.BACKUP.lastNotified < " +
  2. "new Date(new Date().setDate(new Date().getDate() - this.scheduledNotifications.BACKUP.frequency ))' }] }")
  3. List<Recipient> findReadyForBackup();

代码示例来源:origin: spring-projects/spring-data-mongodb

  1. this.isCountQuery = queryAnnotation.count();
  2. this.isExistsQuery = queryAnnotation.exists();
  3. this.isDeleteQuery = queryAnnotation.delete();

代码示例来源:origin: sqshq/piggymetrics

  1. @Query("{ $and: [ {'scheduledNotifications.REMIND.active': true }, { $where: 'this.scheduledNotifications.REMIND.lastNotified < " +
  2. "new Date(new Date().setDate(new Date().getDate() - this.scheduledNotifications.REMIND.frequency ))' }] }")
  3. List<Recipient> findReadyForRemind();

代码示例来源:origin: spring-projects/spring-data-mongodb

  1. this.isCountQuery = queryAnnotation.count();
  2. this.isExistsQuery = queryAnnotation.exists();
  3. this.isDeleteQuery = queryAnnotation.delete();

代码示例来源:origin: spring-projects/spring-data-examples

  1. /**
  2. * String query selecting one entity.
  3. *
  4. * @param lastname
  5. * @return
  6. */
  7. @Query("{ 'firstname': ?0, 'lastname': ?1}")
  8. Maybe<Person> findByFirstnameAndLastname(String firstname, String lastname);

代码示例来源:origin: org.springframework.data/spring-data-mongodb

  1. this.isCountQuery = queryAnnotation.count();
  2. this.isExistsQuery = queryAnnotation.exists();
  3. this.isDeleteQuery = queryAnnotation.delete();

代码示例来源:origin: spring-projects/spring-data-examples

  1. /**
  2. * String query selecting one entity.
  3. *
  4. * @param lastname
  5. * @return
  6. */
  7. @Query("{ 'firstname': ?0, 'lastname': ?1}")
  8. Mono<Person> findByFirstnameAndLastname(String firstname, String lastname);

代码示例来源:origin: org.springframework.data/spring-data-mongodb

  1. this.isCountQuery = queryAnnotation.count();
  2. this.isExistsQuery = queryAnnotation.exists();
  3. this.isDeleteQuery = queryAnnotation.delete();

代码示例来源:origin: spring-projects/spring-data-examples

  1. @Query("{id: ?#{ hasRole('ROLE_ADMIN') ? {$exists:true} : principal.id}}")
  2. List<Person> findAllForCurrentUserById();
  3. }

代码示例来源:origin: spring-projects/spring-data-examples

  1. @Query("{}")
  2. Stream<Person> findAllByCustomQueryWithStream();
  3. }

代码示例来源:origin: spring-projects/spring-data-book

  1. /**
  2. * Returns all {@link Product}s having the given attribute.
  3. *
  4. * @param attribute
  5. * @return
  6. */
  7. @Query("{ ?0 : ?1 }")
  8. List<Product> findByAttributes(String key, String value);
  9. }

代码示例来源:origin: com.capitalone.dashboard/core

  1. /**
  2. * Finds the {@link EnvironmentComponent} collector item id, environment name and component name.
  3. *
  4. * @param collectorItemId collector item id
  5. * @param environmentName environment name
  6. * @param componentName component name
  7. * @return a {@link EnvironmentComponent}
  8. */
  9. @Query(value="{ collectorItemId : ?0, environmentName : ?1, componentName : ?2}")
  10. EnvironmentComponent findComponent(ObjectId collectorItemId, String environmentName, String componentName);

代码示例来源:origin: com.capitalone.dashboard/core

  1. /**
  2. * Finds the {@link CollectorItem} for a given collector and options. This should represent a unique
  3. * instance of a {@link CollectorItem} for a given {@link com.capitalone.dashboard.model.Collector}.
  4. *
  5. * @param collectorId {@link com.capitalone.dashboard.model.Collector} id
  6. * @param options options
  7. * @return a {@link CollectorItem}
  8. */
  9. @Query(value="{ 'collectorId' : ?0, options : ?1}")
  10. T findByCollectorAndOptions(ObjectId collectorId, Map<String, Object> options);

代码示例来源:origin: com.epam.reportportal/commons-dao

  1. /**
  2. * Find {@link Launch} by id, load only next fields:
  3. * <li>id;
  4. * <li>startTime;
  5. * <li>status.
  6. *
  7. * @param id ID of Launch
  8. * @return {@link Launch}
  9. */
  10. @Query(value = "{ '_id': ?0 }", fields = "{'id' : 1, 'startTime':1, 'status':1, 'projectRef':1 }")
  11. Launch loadStatusProjectRefAndStartTime(String id);

代码示例来源:origin: com.epam.reportportal/commons-dao

  1. /**
  2. * Find ID of dashboard by user and projectName, load only id field
  3. *
  4. * @param userName Name of user
  5. * @param projectName Name of project
  6. * @param dashName Name of dashboard
  7. * @return {@link Dashboard}
  8. */
  9. @Query(value = SELECT_BY_USER_PROJECT_DASHNAME, fields = ID_FIELD)
  10. Dashboard findOneByUserProject(String userName, String projectName, String dashName);

代码示例来源:origin: com.epam.reportportal/commons-dao

  1. /**
  2. * Finds log by TestStep ID. Returns fully populated
  3. * {@link com.epam.ta.reportportal.database.entity.Log}
  4. *
  5. * @param testItem
  6. * @return
  7. */
  8. @Query(value = FIND_LOG_ENTRY_BY_STEP_ID, fields = "{'id' : 1}")
  9. List<Log> findLogIdsByTestItemId(String testItem);

代码示例来源:origin: com.epam.reportportal/commons-dao

  1. /**
  2. * Find {@link UserFilter} by user, project and id, load all fields
  3. *
  4. * @param userName
  5. * @param projectName
  6. * @param id
  7. * @return {@link UserFilter}
  8. */
  9. @Query(value = SELECT_BY_USER_ID_PROJECT)
  10. UserFilter findOne(String userName, String id, String projectName);

代码示例来源:origin: com.capitalone.dashboard/core

  1. /**
  2. * Finds all enabled {@link ScoreCollectorItem}s
  3. *
  4. * @param collectorId ID
  5. * @return list of {@link ScoreCollectorItem}s
  6. */
  7. @Query(value = "{ 'collectorId' : ?0, enabled: true}")
  8. List<ScoreCollectorItem> findEnabledScores(ObjectId collectorId);

代码示例来源:origin: com.epam.reportportal/commons-dao

  1. /**
  2. * Streaming launches by provided project ID
  3. *
  4. * @param id
  5. * @return
  6. */
  7. @Query(value = FIND_LAUNCH_ENTRY_BY_PROJECT_ID, fields = "{'id' : 1}")
  8. Stream<Launch> streamIdsByProject(String id);

代码示例来源:origin: com.epam.reportportal/commons-dao

  1. /**
  2. * Find {@link UserFilter} by userName, projectName and id, load only id field
  3. *
  4. * @param user
  5. * @param projectName
  6. * @param id
  7. * @return {@link UserFilter}
  8. */
  9. @Query(value = SELECT_BY_USER_ID_PROJECT, fields = ID_FIELD)
  10. UserFilter findOneLoadId(String userName, String id, String projectName);

相关文章

Query类方法