private void indexEmbeddedColumn(IndexInfo indexInfo, String embeddedColumnName, DBCollection collection) { DBObject keys = new BasicDBObject(); getIndexType(indexInfo.getIndexType(), keys, embeddedColumnName + "." + indexInfo.getColumnName()); DBObject options = new BasicDBObject(); if (indexInfo.getMinValue() != null) { options.put(MongoDBConstants.MIN, indexInfo.getMinValue()); } if (indexInfo.getMaxValue() != null) { options.put(MongoDBConstants.MAX, indexInfo.getMaxValue()); } collection.createIndex(keys, options); KunderaCoreUtils.printQuery("Create indexes on:" + keys, showQuery); }
private void indexColumn(IndexInfo indexInfo, DBCollection collection) { DBObject keys = new BasicDBObject(); getIndexType(indexInfo.getIndexType(), keys, indexInfo.getColumnName()); DBObject options = new BasicDBObject(); if (indexInfo.getMinValue() != null) { options.put(MongoDBConstants.MIN, indexInfo.getMinValue()); } if (indexInfo.getMaxValue() != null) { options.put(MongoDBConstants.MAX, indexInfo.getMaxValue()); } if (indexInfo.getIndexType() != null && (indexInfo.getIndexType().toLowerCase()).equals("unique")) { options.put("unique", true); } collection.createIndex(keys, options); KunderaCoreUtils.printQuery("Create indexes on:" + keys, showQuery); }
@Test public void testWithMultiValueConstructor() { IndexInfo indexInfo = new IndexInfo("personName",12,1,"KEYS", "personName"); indexInfo.setIndexType("KEYS"); indexInfo.setMaxValue(12); indexInfo.setMinValue(1); Assert.assertEquals(12, indexInfo.getMaxValue().intValue()); Assert.assertEquals(1, indexInfo.getMinValue().intValue()); Assert.assertEquals("KEYS", indexInfo.getIndexType()); Assert.assertEquals("personName", indexInfo.getColumnName()); }
private void indexEmbeddedColumn(IndexInfo indexInfo, String embeddedColumnName, DBCollection collection) { DBObject keys = new BasicDBObject(); getIndexType(indexInfo.getIndexType(), keys, embeddedColumnName + "." + indexInfo.getColumnName()); DBObject options = new BasicDBObject(); if (indexInfo.getMinValue() != null) { options.put(MongoDBConstants.MIN, indexInfo.getMinValue()); } if (indexInfo.getMaxValue() != null) { options.put(MongoDBConstants.MAX, indexInfo.getMaxValue()); } collection.createIndex(keys, options); KunderaCoreUtils.printQuery("Create indexes on:" + keys, showQuery); }
private void indexColumn(IndexInfo indexInfo, DBCollection collection) { DBObject keys = new BasicDBObject(); getIndexType(indexInfo.getIndexType(), keys, indexInfo.getColumnName()); DBObject options = new BasicDBObject(); if (indexInfo.getMinValue() != null) { options.put(MongoDBConstants.MIN, indexInfo.getMinValue()); } if (indexInfo.getMaxValue() != null) { options.put(MongoDBConstants.MAX, indexInfo.getMaxValue()); } if (indexInfo.getIndexType() != null && (indexInfo.getIndexType().toLowerCase()).equals("unique")) { options.put("unique", true); } collection.createIndex(keys, options); KunderaCoreUtils.printQuery("Create indexes on:" + keys, showQuery); }