Examples of BasicQuery


Examples of org.springframework.data.mongodb.core.query.BasicQuery

        query.setEnd("2012-06-08 11:00:00");
        query.setLevel("ERROR");
        query.setKeyWord("111");
        System.out.println(query.toQuery().toString());

        Query bquery = new BasicQuery(query.toQuery());
        bquery.limit(100);

        bquery.sort().on("$timestamp", Order.DESCENDING);
        System.out.println(bquery.getQueryObject());
        System.out.println(bquery.getFieldsObject());
        System.out.println(bquery.getSortObject());
//        assertEquals("{ \"timestamp\" : { \"$gt\" : { \"$date\" : \"1970-01-01T00:01:40.000Z\"}} , \"$where\" : \"this.message && this.message.match('hello')\"}",query.toQuery().toString());
    }
View Full Code Here

Examples of org.springframework.data.mongodb.core.query.BasicQuery

    public DBCursor findLogs(String projectName, LogQuery logQuery, int max) throws ParseException {
        Project project = projectService.findProject(projectName);
        MongoTemplate template = project.fetchMongoTemplate();

        Query query = new BasicQuery(logQuery.toQuery());
        query.limit(max);

        query.sort().on("timestamp", Order.DESCENDING);
        logger.debug("find logs from {}  by query {} by sort {}", new Object[]{project.getLogCollection(), query.getQueryObject(), query.getSortObject()});
        DBCursor cursor = template.getCollection(project.getLogCollection()).find(query.getQueryObject()).sort(query.getSortObject()).limit(max);
        return cursor;
    }
View Full Code Here

Examples of org.timedex.query.BasicQuery

  private static final String OUTPUT_FILE = "random_events.txt";
  private static final int NUM_EVENTS = 100;
  private static final SessionStrategy sessionStrategy = HibernateSessionStrategy.getInstance();
 
  public static void main(String[] args) {   
    Query q = new BasicQuery();
    List<Event> events;
    try {
      sessionStrategy.beginTransaction();
     
      events = q.getRandom(NUM_EVENTS);
     
      sessionStrategy.commitTransaction();
    } finally {
      sessionStrategy.rollbackIfActive();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.