/** * Create an index key for an ascending index on the given fields. * * @param fieldNames the field names, which must contain at least one * @return the index specification * @mongodb.driver.manual core/indexes indexes */ public static Bson ascending(final String... fieldNames) { return ascending(asList(fieldNames)); }
@Inject public MongoDBSessionServiceImpl(MongoConnection mongoConnection) { super(mongoConnection); final MongoDatabase database = mongoConnection.getMongoDatabase(); final MongoCollection<Document> sessions = database.getCollection(MongoDbSession.COLLECTION_NAME); sessions.createIndex(Indexes.ascending(MongoDbSession.FIELD_SESSION_ID)); }
private static void createIndex(MongoConnection mongoConnection) { final IndexOptions indexOptions = new IndexOptions() .name(INDEX_NAME) .unique(true); mongoConnection.getMongoDatabase() .getCollection(COLLECTION_NAME) .createIndex(Indexes.ascending("name"), indexOptions); }
.name(MongoDbGrokPatternService.INDEX_NAME) .unique(true); collection.createIndex(Indexes.ascending("name"), indexOptions);
/** * Create an index key for an ascending index on the given fields. * * @param fieldNames the field names, which must contain at least one * @return the index specification * @mongodb.driver.manual core/indexes indexes */ public static Bson ascending(final String... fieldNames) { return ascending(asList(fieldNames)); }
@PostConstruct void ensureIndexes() { of(DSL.CREATE_TIME, DSL.START_TIME, DSL.END_TIME, DSL.JOB_ID, DSL.STATUS) .forEach(it -> collection.createIndex(ascending(format("{0}.{1}", DSL.EXECUTION, it)))); } }
@Inject public ConversationMemoryStore(MongoDatabase database, IDocumentBuilder documentBuilder) { conversationCollection = database.getCollection(CONVERSATION_COLLECTION); this.documentBuilder = documentBuilder; conversationCollection.createIndex(Indexes.ascending(CONVERSATION_STATE_FIELD)); conversationCollection.createIndex(Indexes.ascending(CONVERSATION_BOT_ID_FIELD)); conversationCollection.createIndex(Indexes.ascending(CONVERSATION_BOT_VERSION_FIELD)); }
@PostConstruct void ensureIndexes() { of(DSL.CREATE_TIME) .forEach(it -> collection.createIndex(ascending(it))); } }
@PostConstruct void ensureIndexes() { of(DSL.CREATE_TIME, DSL.START_TIME, DSL.END_TIME, DSL.PARENT_TASK_EXECUTION_ID, DSL.STATUS) .forEach(it -> collection.createIndex(ascending(it))); }
@PostConstruct void ensureIndexes() { of(DSL.CREATE_TIME, "stackId") .forEach(it -> collection.createIndex(ascending(it))); } }
@Inject public MongoDBSessionServiceImpl(MongoConnection mongoConnection) { super(mongoConnection); final MongoDatabase database = mongoConnection.getMongoDatabase(); final MongoCollection<Document> sessions = database.getCollection(MongoDbSession.COLLECTION_NAME); sessions.createIndex(Indexes.ascending(MongoDbSession.FIELD_SESSION_ID)); }
@Inject public PropertiesStore(MongoDatabase database) { RuntimeUtilities.checkNotNull(database, "database"); this.collection = database.getCollection(COLLECTION_PROPERTIES); this.propertiesStore = new PropertiesResourceStore(); collection.createIndex(Indexes.ascending(USER_ID), new IndexOptions().unique(true)); }
/** * Creates the indexes required to work with the TokenStore. */ @PostConstruct public void ensureIndexes() { mongoTemplate.trackingTokensCollection().createIndex(Indexes.ascending("processorName", "segment"), new IndexOptions().unique(true)); }
/** * Creates the indexes required to work with the TokenStore. */ @PostConstruct public void ensureIndexes() { mongoTemplate.trackingTokensCollection().createIndex(Indexes.ascending("processorName", "segment"), new IndexOptions().unique(true)); }
@Inject public BotTriggerStore(MongoDatabase database, IJsonSerialization jsonSerialization, IDocumentBuilder documentBuilder) { this.jsonSerialization = jsonSerialization; RuntimeUtilities.checkNotNull(database, "database"); this.collection = database.getCollection(COLLECTION_BOT_TRIGGERS); this.documentBuilder = documentBuilder; this.botTriggerStore = new BotTriggerResourceStore(); collection.createIndex(Indexes.ascending(INTENT_FIELD), new IndexOptions().unique(true)); }
@Override public void init() { for (PhysicalSchema physicalSchema : env.getPhysicalSchemas()) { MongoDatabase database = mongoClient.getDatabase(physicalSchema.getPhysicalName()); try { database.createCollection(getAuditContainerName()); } catch (Exception e) { // create if it doesn't exist already; TODO clean this up } MongoCollection<Document> collection = database.getCollection(getAuditContainerName()); collection.createIndex(Indexes.ascending(changeNameColumn, "OBJECTNAME")); } }
/** * Ensure that expected collection indexes exist. * * @throws SiteWhereException */ protected void ensureIndexes() throws SiteWhereException { getMongoClient().getAssetCategoriesCollection(getTenant()) .createIndex(Indexes.ascending(MongoAssetCategory.PROP_ID), new IndexOptions().unique(true)); getMongoClient().getAssetsCollection(getTenant()).createIndex(Indexes .compoundIndex(Indexes.ascending(MongoAsset.PROP_CATEGORY_ID), Indexes.ascending(MongoAsset.PROP_ID)), new IndexOptions().unique(true)); }
/** * Ensure that expected collection indexes exist. * * @throws SiteWhereException */ protected void ensureIndexes() throws SiteWhereException { getMongoClient().getAssetTypesCollection().createIndex(Indexes.ascending(MongoPersistentEntity.PROP_TOKEN), new IndexOptions().unique(true)); getMongoClient().getAssetsCollection().createIndex(Indexes.ascending(MongoPersistentEntity.PROP_TOKEN), new IndexOptions().unique(true)); }
@Override protected final void ensureIndexes() { IndexOptions options = new IndexOptions().background(true); collection().createIndex(Indexes.compoundIndex(Indexes.ascending(JobStructure.JOB_TYPE.key()), Indexes.descending(JobStructure.STARTED.key())), options); collection().createIndex(Indexes.ascending(JobStructure.STARTED.key()), options); collection().createIndex(Indexes.ascending(JobStructure.LAST_UPDATED.key(), JobStructure.STOPPED.key()), options); }
@Override protected final void ensureIndexes() { IndexOptions options = new IndexOptions().background(true); collection().createIndex(Indexes.compoundIndex(Indexes.ascending(JobStructure.JOB_TYPE.key()), Indexes.descending(JobStructure.STARTED.key())), options); collection().createIndex(Indexes.ascending(JobStructure.STARTED.key()), options); collection().createIndex(Indexes.ascending(JobStructure.LAST_UPDATED.key(), JobStructure.STOPPED.key()), options); }