List of usage examples for com.mongodb.client MongoCollection count
@Deprecated
long count(ClientSession clientSession);
From source file:uk.ac.ebi.eva.dbmigration.mongodb.ExtractAnnotationFromVariant.java
License:Apache License
@ChangeSet(order = "004", id = "updateAnnotationMetadata", author = "EVA") public void updateAnnotationMetadata(MongoDatabase mongoDatabase) { final MongoCollection<Document> annotationMetadataCollection = mongoDatabase .getCollection(databaseParameters.getDbCollectionsAnnotationMetadataName()); logger.info("4) update annotation metadata in collection {}", annotationMetadataCollection.getNamespace()); String id = databaseParameters.getVepVersion() + "_" + databaseParameters.getVepCacheVersion(); Document metadata = new Document(ID_FIELD, id); if (annotationMetadataCollection.count(metadata) == 0) { metadata.append(VEP_VERSION_FIELD, databaseParameters.getVepVersion()).append(CACHE_VERSION_FIELD, databaseParameters.getVepCacheVersion()); annotationMetadataCollection.insertOne(metadata); }//from w w w . j a v a 2 s. c o m }