Example usage for org.springframework.data.mongodb.core.query Criteria where

List of usage examples for org.springframework.data.mongodb.core.query Criteria where

Introduction

In this page you can find the example usage for org.springframework.data.mongodb.core.query Criteria where.

Prototype

public static Criteria where(String key) 

Source Link

Document

Static factory method to create a Criteria using the provided key

Usage

From source file:data.repository.pragma.mongo.PermanentRepository.java

public boolean existDOByID(String id) {
    boolean result = repoTemplate.findOne(Query.query(Criteria.where("_id").is(id))).equals(null);
    return !result;
}

From source file:com.ninjas.movietime.repository.TheaterRepository.java

public Page<Theater> listByTheaterChain(Collection<TheaterChain> theaterChains, int page, int size) {
    Preconditions.checkArgument(theaterChains.size() > 0, "Theater Chain list cannot be empty");
    final Pageable pageable = new PageRequest(page, size, new Sort(Sort.Direction.ASC, "name"));
    final Query query = Query.query(Criteria.where("theaterChain").in(theaterChains));
    return findPaged(pageable, query, Theater.class);
}

From source file:quanlyhocvu.api.mongodb.DAO.ChiTietDiemDAO.java

public ChiTietDiemDTO getChiTietDiemByIdDiem(DiemDTO diem) {
    Query query = Query.query(Criteria.where("diem.$id").is(new ObjectId(diem.getid())));
    ChiTietDiemDTO obj = mongoOperation.findOne(query, ChiTietDiemDTO.class);
    if (obj == null) {
        ChiTietDiemDTO newObj = new ChiTietDiemDTO();
        newObj.setDiem(diem);/*from w  w  w.ja  v  a  2 s. co m*/
        mongoOperation.insert(newObj);
        obj = newObj;
    }

    return obj;
}

From source file:st.malike.service.mongo.DemographicSummaryService.java

public List getDemographicSummaryByDate(Date dateCreated) {
    Query query = new Query();
    query.addCriteria(Criteria.where("dateCreated").is(dateCreated));
    return mongoTemplate.find(query, DemographicSummary.class, "demographic_summary");
}

From source file:org.oncoblocks.centromere.mongodb.test.EntrezGeneRepository.java

public List<EntrezGene> guessGene(String keyword) {
    Query query = new Query(Criteria.where("primaryGeneSymbol").is(keyword));
    Sort sort = new Sort(new Sort.Order(Sort.Direction.ASC, "entrezGeneId"));
    List<EntrezGene> genes = getMongoOperations().find(query.with(sort), getModel());
    if (genes != null && genes.size() > 0)
        return genes;
    query = new Query(Criteria.where("aliases").is(keyword));
    genes = getMongoOperations().find(query.with(sort), getModel());
    if (genes != null && genes.size() > 0)
        return genes;
    return null;/*  w  ww  .ja  va 2 s . c o m*/
}

From source file:quanlyhocvu.api.mongodb.DAO.KhoiLopDAO.java

public KhoiLopDTO getByName(String tenKhoiLop) {
    Query query = Query.query(Criteria.where("tenKhoiLop").is(tenKhoiLop));
    KhoiLopDTO obj = mongoOperation.findOne(query, KhoiLopDTO.class);
    return obj;//  w  ww .ja v a 2 s  . co  m
}

From source file:data.repository.pragma.mongo.StagingDBRepository.java

public boolean existDOByID(String id) {
    boolean result = stagingDBTemplate.findOne(Query.query(Criteria.where("_id").is(id))).equals(null);
    return !result;
}

From source file:no.nlf.dal.LicenseController.java

public License update(License license) {
    MongoLicense mongoLicense = new MongoLicense(license);
    Query searchQuery = new Query(Criteria.where("id").is(mongoLicense.getId()));

    Update updateLicense = new Update();

    updateLicense.set("melwinId", mongoLicense.getMelwinId());
    updateLicense.set("licenseName", mongoLicense.getLicenseName());
    updateLicense.set("active", mongoLicense.isActive());

    mongoLicense = appContext.mongoOperation().findAndModify(searchQuery, updateLicense,
            new FindAndModifyOptions().returnNew(true), MongoLicense.class);

    if (mongoLicense == null) {
        return new License();
    }/*w ww  .j a va  2s . c  om*/

    return mongoLicense.toLicense();
}

From source file:br.com.ezequieljuliano.argos.persistence.UserDAO.java

public User findByIdentifierKey(String identifierKey) {
    Query query = new Query(Criteria.where("identifierKey").is(identifierKey));
    return getMongoOperations().findOne(query, User.class);
}

From source file:eu.trentorise.smartcampus.communicatorservice.storage.CommunicatorStorage.java

public <T extends BasicObject> void deleteObjectPermanently(T object) throws DataException {
    mongoTemplate.remove(Query.query(Criteria.where("id").is(object.getId())), getObjectClass());
}