modules/core/nuxeo-core-storage-mongodb/src/main/java/org/nuxeo/ecm/core/storage/mongodb/MongoDBConnection.java
/**
     * Allocates a new sequence block. The database contains the last value from the last block.
     */
Allocates a new sequence block. The database contains the last value from the last block.
Allocates a new sequence block . The database contains the last value from the last block .
protected long updateSequence() {
        long sequenceBlockSize = mongoDBRepository.sequenceBlockSize;
        MongoCollection<Document> countersColl = mongoDBRepository.getCountersCollection();
        Bson filter = Filters.eq(MONGODB_ID, COUNTER_NAME_UUID);
        Bson update = Updates.inc(COUNTER_FIELD, Long.valueOf(sequenceBlockSize));
        Document idCounter = countersColl.findOneAndUpdate(filter, update,
                new FindOneAndUpdateOptions().returnDocument(ReturnDocument.AFTER));
        if (idCounter == null) {
            throw new NuxeoException("Repository id counter not initialized");
        }
        return idCounter.getLong(COUNTER_FIELD).longValue() - sequenceBlockSize;
    }
protected long updateSequence ( ) { long sequenceBlockSize = mongoDBRepository . sequenceBlockSize ; MongoCollection < Document > countersColl = mongoDBRepository . getCountersCollection ( ) ; Bson filter = Filters . eq ( MONGODB_ID , COUNTER_NAME_UUID ) ; Bson update = Updates . inc ( COUNTER_FIELD , Long . valueOf ( sequenceBlockSize ) ) ; Document idCounter = countersColl . findOneAndUpdate ( filter , update , new FindOneAndUpdateOptions ( ) . returnDocument ( ReturnDocument . AFTER ) ) ; if ( idCounter == null ) { throw new NuxeoException ( "Repository id counter not initialized" ) ; } return idCounter . getLong ( COUNTER_FIELD ) . longValue ( ) - sequenceBlockSize ; }
Allocates a new sequence block.
Allocates a new sequence block .