@Override public MongoCollection<Document> getCollection(String collectionName) { // native MongoDB objects that offer methods with ClientSession must not be proxied. return delegate.getCollection(collectionName); }
protected DBCollection getPrimaryCollection() { return mongoTemplate.getCollection(getCollectionName()); }
if (mongoTemplate.getCollection(collName) == null) { mongoTemplate.createCollection(collName);
FindIterable<Document> iterable = template.getCollection(options.getCollectionName()).find(filter) .cursorType(CursorType.TailableAwait).noCursorTimeout(true);
@Override public MongoCollection<Document> getCollection(String collectionName) { // native MongoDB objects that offer methods with ClientSession must not be proxied. return delegate.getCollection(collectionName); }
@Override @ManagedAttribute public long getMessageCount() { return this.template.getCollection(this.collectionName).countDocuments(); }
@Override public Iterator<MessageGroup> iterator() { Query query = Query.query(Criteria.where(MessageDocumentFields.GROUP_ID).exists(true)); Iterable<String> groupIds = mongoTemplate.getCollection(collectionName) .distinct(MessageDocumentFields.GROUP_ID, query.getQueryObject(), String.class); return StreamSupport.stream(groupIds.spliterator(), false) .map(this::getMessageGroup) .iterator(); }
@Override public Iterator<MessageGroup> iterator() { List<MessageGroup> messageGroups = new ArrayList<>(); Query query = Query.query(Criteria.where(GROUP_ID_KEY).exists(true)); @SuppressWarnings("rawtypes") Iterable<String> groupIds = this.template.getCollection(this.collectionName) .distinct(GROUP_ID_KEY, query.getQueryObject(), String.class); for (Object groupId : groupIds) { messageGroups.add(getMessageGroup(groupId)); } return messageGroups.iterator(); }
@Override @ManagedAttribute public int getMessageGroupCount() { Query query = Query.query(Criteria.where(MessageDocumentFields.GROUP_ID).exists(true)); return this.mongoTemplate.getCollection(this.collectionName) .distinct(MessageDocumentFields.GROUP_ID, query.getQueryObject(), Object.class) .into(new ArrayList<>()) .size(); }
@Override @ManagedAttribute public int getMessageGroupCount() { Query query = Query.query(Criteria.where(MessageDocumentFields.GROUP_ID).exists(true)); return this.template.getCollection(this.collectionName) .distinct(MessageDocumentFields.GROUP_ID, query.getQueryObject(), Object.class) .into(new ArrayList<>()) .size(); }
FindIterable<Document> iterable = template.getCollection(options.getCollectionName()).find(filter) .cursorType(CursorType.TailableAwait).noCursorTimeout(true);
@Override public long getMessageCount() { Query query = Query.query(Criteria.where(MessageDocumentFields.MESSAGE_ID).exists(true) .and(MessageDocumentFields.GROUP_ID).exists(false)); return this.mongoTemplate.getCollection(this.collectionName).countDocuments(query.getQueryObject()); }
@Autowired public ApplicationOidDAOMongoImpl(final MongoTemplate mongoTemplate, @Value("${application.oid.prefix}") final String oidPrefix) { this.oidPrefix = oidPrefix + "."; sequenceCollection = mongoTemplate.getCollection(SEQUENCE_NAME); }
public void init(HazelcastInstance hazelcastInstance, Properties properties, String mapName) { if (properties.get("collection") != null) { this.mapName = (String) properties.get("collection"); } else { this.mapName = mapName; } this.coll = mongoTemplate.getCollection(this.mapName); this.converter = new SpringMongoDBConverter(mongoTemplate); }
@Override public void drop() { mongoTemplate.getCollection(collectionName).drop(); if (keepHistory) { mongoTemplate.getCollection(collectionNameHist).drop(); } updateMongoSchema(); }
@Override @ManagedAttribute public long getMessageCount() { return this.template.getCollection(this.collectionName).countDocuments(); }
@Override public Iterator<MessageGroup> iterator() { List<MessageGroup> messageGroups = new ArrayList<>(); Query query = Query.query(Criteria.where(GROUP_ID_KEY).exists(true)); @SuppressWarnings("rawtypes") Iterable<String> groupIds = this.template.getCollection(this.collectionName) .distinct(GROUP_ID_KEY, query.getQueryObject(), String.class); for (Object groupId : groupIds) { messageGroups.add(getMessageGroup(groupId)); } return messageGroups.iterator(); }
@Override @ManagedAttribute public int getMessageGroupCount() { Query query = Query.query(Criteria.where(MessageDocumentFields.GROUP_ID).exists(true)); return this.mongoTemplate.getCollection(this.collectionName) .distinct(MessageDocumentFields.GROUP_ID, query.getQueryObject(), Object.class) .into(new ArrayList<>()) .size(); }
@Override public long getMessageCount() { Query query = Query.query(Criteria.where(MessageDocumentFields.MESSAGE_ID).exists(true) .and(MessageDocumentFields.GROUP_ID).exists(false)); return this.mongoTemplate.getCollection(this.collectionName).countDocuments(query.getQueryObject()); }
@Override public void onBeforeDelete(BeforeDeleteEvent<Project> event) { for (DBObject dbObject : mongoTemplate.getCollection(event.getCollectionName()) .find(queryMapper.getMappedObject(event.getDBObject(), context.getPersistentEntity(Project.class)))) { final String id = dbObject.get("_id").toString(); updateDefaultProject(id); removeProjectShareable(id); externalSystemRepository.deleteByProjectRef(id); activityRepository.deleteByProjectRef(id); launchRepository.deleteByProjectRef(id); } }