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

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

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

Query介绍

暂无

代码示例

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

@Query("{}")
  Stream<Person> findAllByCustomQueryWithStream();
}

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

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

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

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

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

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

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

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

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

/**
 * Find ID of dashboard by user and projectName, load only id field
 *
 * @param userName    Name of user
 * @param projectName Name of project
 * @param dashName    Name of dashboard
 * @return {@link Dashboard}
 */
@Query(value = SELECT_BY_USER_PROJECT_DASHNAME, fields = ID_FIELD)
Dashboard findOneByUserProject(String userName, String projectName, String dashName);

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

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

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

/**
 * Find {@link UserFilter} by user, project and id, load all fields
 * 
 * @param userName
 * @param projectName
 * @param id
 * @return {@link UserFilter}
 */
@Query(value = SELECT_BY_USER_ID_PROJECT)
UserFilter findOne(String userName, String id, String projectName);

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

/**
 * Finds all enabled {@link ScoreCollectorItem}s
 *
 * @param collectorId ID
 * @return list of {@link ScoreCollectorItem}s
 */
@Query(value = "{ 'collectorId' : ?0, enabled: true}")
List<ScoreCollectorItem> findEnabledScores(ObjectId collectorId);

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

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

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

/**
 * Find {@link UserFilter} by userName, projectName and id, load only id field
 * 
 * @param user
 * @param projectName
 * @param id
 * @return {@link UserFilter}
 */
@Query(value = SELECT_BY_USER_ID_PROJECT, fields = ID_FIELD)
UserFilter findOneLoadId(String userName, String id, String projectName);

相关文章