Example usage for com.mongodb DBCollection getName

List of usage examples for com.mongodb DBCollection getName

Introduction

In this page you can find the example usage for com.mongodb DBCollection getName.

Prototype

public String getName() 

Source Link

Document

Get the name of a collection.

Usage

From source file:org.teiid.translator.mongodb.MongoDBUpdateExecution.java

License:Open Source License

private void createIndex(DBCollection collection, KeyRecord record, boolean unique) {
    BasicDBObject key = new BasicDBObject();
    for (Column c : record.getColumns()) {
        key.append(getRecordName(c), 1);
    }//from   w w  w  .j a  v a2 s. c  om
    BasicDBObject options = new BasicDBObject();
    options.put("name", record.getName()); //$NON-NLS-1$
    options.put("ns", collection.getName()); //$NON-NLS-1$
    if (unique) {
        options.put("unique", Boolean.TRUE); //$NON-NLS-1$
    }
    collection.createIndex(key, options);
}