Tabnine Logo
IndexOptions.isUnique
Code IndexAdd Tabnine to your IDE (free)

How to use
isUnique
method
in
com.mongodb.client.model.IndexOptions

Best Java code snippets using com.mongodb.client.model.IndexOptions.isUnique (Showing top 7 results out of 315)

origin: org.mongodb/mongo-java-driver

.name(model.getOptions().getName())
.background(model.getOptions().isBackground())
.unique(model.getOptions().isUnique())
.sparse(model.getOptions().isSparse())
.expireAfter(model.getOptions().getExpireAfter(TimeUnit.SECONDS), TimeUnit.SECONDS)
origin: jphp-group/jphp

@Override
public Memory unconvert(Environment env, TraceInfo trace, IndexOptions arg) throws Throwable {
  if (arg == null) return Memory.NULL;
  ArrayMemory options = ArrayMemory.createHashed(12);
  options.put("name", arg.getName());
  options.put("background", arg.isBackground());
  options.put("sparse", arg.isSparse());
  options.put("unique", arg.isUnique());
  if (arg.getDefaultLanguage() != null) options.put("defaultLanguage", arg.getDefaultLanguage());
  if (arg.getBits() != null) options.put("bits", arg.getBits());
  if (arg.getMax() != null) options.put("max", arg.getMax());
  if (arg.getMin() != null) options.put("min", arg.getMin());
  if (arg.getLanguageOverride() != null) options.put("languageOverride", arg.getLanguageOverride());
  if (arg.getVersion() != null) options.put("version", arg.getVersion());
  if (arg.getTextVersion() != null) options.put("textVersion", arg.getTextVersion());
  if (arg.getSphereVersion() != null) options.put("sphereVersion", arg.getSphereVersion());
  return options;
}
origin: MorphiaOrg/morphia

@Test
public void indexOptionsConversion() {
  IndexOptionsBuilder indexOptions = indexOptions();
  com.mongodb.client.model.IndexOptions options = indexHelper.convert(indexOptions, false);
  assertEquals("index_name", options.getName());
  assertTrue(options.isBackground());
  assertTrue(options.isUnique());
  assertTrue(options.isSparse());
  assertEquals(Long.valueOf(42), options.getExpireAfter(TimeUnit.SECONDS));
  assertEquals("en", options.getDefaultLanguage());
  assertEquals("de", options.getLanguageOverride());
  assertEquals(indexHelper.convert(indexOptions.collation()), options.getCollation());
  assertTrue(indexHelper.convert(indexOptions, true).isBackground());
  assertTrue(indexHelper.convert(indexOptions.background(false), true).isBackground());
  assertTrue(indexHelper.convert(indexOptions.background(true), true).isBackground());
  assertTrue(indexHelper.convert(indexOptions.background(true), false).isBackground());
  assertFalse(indexHelper.convert(indexOptions.background(false), false).isBackground());
}
origin: org.hibernate.ogm/hibernate-ogm-mongodb

private boolean thereIsNoUniqueConstraintOnSameColumns(MongoDBIndexSpec indexSpec) {
  for ( MongoDBIndexSpec otherIndex : indexSpecs ) {
    boolean hasSameColumns = otherIndex.getIndexKeysDocument().equals( indexSpec.getIndexKeysDocument() );
    boolean isUniqueConstraint = otherIndex.getOptions().isUnique();
    // Skip index creation if a unique constraint is already present
    if ( hasSameColumns && isUniqueConstraint ) {
      return false;
    }
  }
  return true;
}
origin: hibernate/hibernate-ogm

private boolean thereIsNoUniqueConstraintOnSameColumns(MongoDBIndexSpec indexSpec) {
  for ( MongoDBIndexSpec otherIndex : indexSpecs ) {
    boolean hasSameColumns = otherIndex.getIndexKeysDocument().equals( indexSpec.getIndexKeysDocument() );
    boolean isUniqueConstraint = otherIndex.getOptions().isUnique();
    // Skip index creation if a unique constraint is already present
    if ( hasSameColumns && isUniqueConstraint ) {
      return false;
    }
  }
  return true;
}
origin: org.wso2.extension.siddhi.store.mongodb/siddhi-store-mongodb

  indexOptionsMap.put("v", expectedIndexOptions.getVersion());
indexOptionsMap.put("unique", expectedIndexOptions.isUnique());
indexOptionsMap.put("background", expectedIndexOptions.isBackground());
indexOptionsMap.put("sparse", expectedIndexOptions.isSparse());
origin: org.mongodb/mongodb-driver-core

.name(model.getOptions().getName())
.background(model.getOptions().isBackground())
.unique(model.getOptions().isUnique())
.sparse(model.getOptions().isSparse())
.expireAfter(model.getOptions().getExpireAfter(TimeUnit.SECONDS), TimeUnit.SECONDS)
com.mongodb.client.modelIndexOptionsisUnique

Javadoc

Gets if the index should be unique.

Popular methods of IndexOptions

  • <init>
  • unique
    Should the index should be unique.
  • name
    Sets the name of the index.
  • background
    Should the index should be created in the background
  • expireAfter
    Sets the time to live for documents in the collection
  • sparse
    Should the index only references documents with the specified field
  • partialFilterExpression
    Sets the filter expression for the documents to be included in the index
  • defaultLanguage
    Sets the language for the text index.The language that determines the list of stop words and the rul
  • languageOverride
    Sets the name of the field that contains the language string.For text indexes, the name of the field
  • weights
    Sets the weighting object for use with a text index.An document that represents field and weight pai
  • bits
    Sets the number of precision of the stored geohash value of the location data in 2d indexes.
  • getName
    Gets the name of the index.
  • bits,
  • getName,
  • max,
  • min,
  • sphereVersion,
  • bucketSize,
  • collation,
  • getDefaultLanguage,
  • getLanguageOverride

Popular in Java

  • Creating JSON documents from java classes using gson
  • getApplicationContext (Context)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • Table (com.google.common.collect)
    A collection that associates an ordered pair of keys, called a row key and a column key, with a sing
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now