类com.mongodb.client.model.IndexModel源码实例Demo

下面列出了怎么用com.mongodb.client.model.IndexModel的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: ditto   文件: Index.java
/**
 * Creates a new {@link IndexModel}, which can be used for creating indices using MongoDB Java drivers.
 *
 * @return the created {@link IndexModel}
 */
public IndexModel toIndexModel() {
    final IndexOptions options = new IndexOptions()
            .name(name)
            .unique(unique)
            .sparse(sparse)
            .background(background);

    if (!partialFilterExpression.isEmpty()) {
        options.partialFilterExpression(partialFilterExpression);
    }

    getExpireAfterSeconds().ifPresent(n -> options.expireAfter(n, TimeUnit.SECONDS));

    return new IndexModel(keys, options);
}
 
@Override
public Observable<String> createIndexes(final List<IndexModel> indexes) {
    return RxObservables.create(Observables.observeAndFlatten(new Block<SingleResultCallback<List<String>>>() {
        @Override
        public void apply(final SingleResultCallback<List<String>> callback) {
            wrapped.createIndexes(indexes, callback);
        }
    }), observableAdapter);
}
 
@Override
public Publisher<String> createIndexes(final List<IndexModel> indexes, final CreateIndexOptions createIndexOptions) {
    return new ObservableToPublisher<String>(com.mongodb.async.client.Observables.observeAndFlatten(
            new Block<com.mongodb.async.SingleResultCallback<List<String>>>() {
                @Override
                public void apply(final com.mongodb.async.SingleResultCallback<List<String>> callback) {
                    wrapped.createIndexes(indexes, createIndexOptions, callback);
                }
            }));
}
 
@Override
public Publisher<String> createIndexes(final ClientSession clientSession, final List<IndexModel> indexes,
                                       final CreateIndexOptions createIndexOptions) {
    return new ObservableToPublisher<String>(com.mongodb.async.client.Observables.observeAndFlatten(
            new Block<com.mongodb.async.SingleResultCallback<List<String>>>() {
                @Override
                public void apply(final com.mongodb.async.SingleResultCallback<List<String>> callback) {
                    wrapped.createIndexes(clientSession.getWrapped(), indexes, createIndexOptions, callback);
                }
            }));
}
 
源代码5 项目: quarkus   文件: ReactiveMongoCollectionImpl.java
@Override
public Uni<List<String>> createIndexes(List<IndexModel> indexes) {
    return Wrappers.toUniOfList(collection.createIndexes(indexes));
}
 
源代码6 项目: quarkus   文件: ReactiveMongoCollectionImpl.java
@Override
public Uni<List<String>> createIndexes(List<IndexModel> indexes, CreateIndexOptions createIndexOptions) {
    return Wrappers.toUniOfList(collection.createIndexes(indexes, createIndexOptions));
}
 
源代码7 项目: quarkus   文件: ReactiveMongoCollectionImpl.java
@Override
public Uni<List<String>> createIndexes(ClientSession clientSession, List<IndexModel> indexes) {
    return Wrappers.toUniOfList(collection.createIndexes(clientSession, indexes));
}
 
源代码8 项目: quarkus   文件: ReactiveMongoCollectionImpl.java
@Override
public Uni<List<String>> createIndexes(ClientSession clientSession, List<IndexModel> indexes,
        CreateIndexOptions createIndexOptions) {
    return Wrappers.toUniOfList(collection.createIndexes(clientSession, indexes, createIndexOptions));
}
 
源代码9 项目: MongoDB-Plugin   文件: MongoIndex.java
public MongoIndex add(MongoIndex mongoIndex) {
    indexModels.add(new IndexModel(Indexes.compoundIndex(mongoIndex.getBson()), mongoIndex));
    return this;
}
 
@Override
public Publisher<String> createIndexes(final List<IndexModel> indexes) {
    return createIndexes(indexes, new CreateIndexOptions());
}
 
@Override
public Publisher<String> createIndexes(final ClientSession clientSession, final List<IndexModel> indexes) {
    return createIndexes(clientSession, indexes, new CreateIndexOptions());
}
 
源代码12 项目: quarkus   文件: ReactiveMongoCollection.java
/**
 * Create multiple indexes.
 *
 * @param indexes the list of indexes
 * @return a {@link Uni} completed with the result when the operation is done. The redeemed list contains the
 *         created index names.
 */
Uni<List<String>> createIndexes(List<IndexModel> indexes);
 
源代码13 项目: quarkus   文件: ReactiveMongoCollection.java
/**
 * Create multiple indexes.
 *
 * @param indexes the list of indexes
 * @param createIndexOptions options to use when creating indexes
 * @return a {@link Uni} completed with the result when the operation is done. The redeemed list contains the
 *         created index names.
 */
Uni<List<String>> createIndexes(List<IndexModel> indexes, CreateIndexOptions createIndexOptions);
 
源代码14 项目: quarkus   文件: ReactiveMongoCollection.java
/**
 * Create multiple indexes.
 *
 * @param clientSession the client session with which to associate this operation
 * @param indexes the list of indexes
 * @return a {@link Uni} completed with the result when the operation is done. The redeemed list contains the
 *         created index names.
 */
Uni<List<String>> createIndexes(ClientSession clientSession, List<IndexModel> indexes);
 
源代码15 项目: quarkus   文件: ReactiveMongoCollection.java
/**
 * Create multiple indexes.
 *
 * @param clientSession the client session with which to associate this operation
 * @param indexes the list of indexes
 * @param createIndexOptions options to use when creating indexes
 * @return a {@link Uni} completed with the result when the operation is done. The redeemed list contains the
 *         created index names.
 */
Uni<List<String>> createIndexes(ClientSession clientSession, List<IndexModel> indexes,
        CreateIndexOptions createIndexOptions);
 
源代码16 项目: ditto   文件: IndexOperations.java
/**
 * Creates the specified index. Throws an exception if the index with the same name already exists.
 *
 * <p>
 * Just does nothing if another index for the same keys with conflicting options already exists. For details, see
 * the <a href="https://docs.mongodb.com/manual/reference/method/db.collection.createIndex/">MongoDB documentation</a>.
 * </p>
 *
 * @param collectionName the name of the collection containing the index.
 * @param index the index.
 * @return a source which emits {@link Success}.
 */
public Source<Success, NotUsed> createIndex(final String collectionName, final Index index) {
    final IndexModel indexModel = index.toIndexModel();
    return Source.fromPublisher(getCollection(collectionName).createIndex(indexModel.getKeys(), indexModel
            .getOptions())).map(unused -> Success.SUCCESS);
}
 
源代码17 项目: mongo-java-driver-rx   文件: MongoCollection.java
/**
 * Create multiple indexes.
 *
 * @param indexes the list of indexes
 * @return an Observable with a single element indicating when the operation has completed
 * @mongodb.driver.manual reference/command/createIndexes Create indexes
 * @mongodb.server.release 2.6
 */
Observable<String> createIndexes(List<IndexModel> indexes);
 
/**
 * Create multiple indexes.
 *
 * @param indexes the list of indexes
 * @return a publisher with a single element indicating when the operation has completed
 * @mongodb.driver.manual reference/command/createIndexes Create indexes
 * @mongodb.server.release 2.6
 */
Publisher<String> createIndexes(List<IndexModel> indexes);
 
/**
 * Create multiple indexes.
 *
 * @param indexes the list of indexes
 * @param createIndexOptions options to use when creating indexes
 * @return a publisher with a single element indicating when the operation has completed
 * @mongodb.driver.manual reference/command/createIndexes Create indexes
 * @mongodb.server.release 2.6
 * @since 1.7
 */
Publisher<String> createIndexes(List<IndexModel> indexes, CreateIndexOptions createIndexOptions);
 
/**
 * Create multiple indexes.
 *
 * @param clientSession the client session with which to associate this operation
 * @param indexes the list of indexes
 * @return a publisher with a single element indicating when the operation has completed
 * @mongodb.driver.manual reference/command/createIndexes Create indexes
 * @mongodb.server.release 3.6
 * @since 1.7
 */
Publisher<String> createIndexes(ClientSession clientSession, List<IndexModel> indexes);
 
/**
 * Create multiple indexes.
 *
 * @param clientSession the client session with which to associate this operation
 * @param indexes the list of indexes
 * @param createIndexOptions options to use when creating indexes
 * @return a publisher with a single element indicating when the operation has completed
 * @mongodb.driver.manual reference/command/createIndexes Create indexes
 * @mongodb.server.release 3.6
 * @since 1.7
 */
Publisher<String> createIndexes(ClientSession clientSession, List<IndexModel> indexes, CreateIndexOptions createIndexOptions);
 
 类所在包
 同包方法