Spring Data MongoDB - Core

org.springframework.data.mongodb.core.index
Class Index

java.lang.Object
  extended by org.springframework.data.mongodb.core.index.Index
All Implemented Interfaces:
IndexDefinition

public class Index
extends Object
implements IndexDefinition


Nested Class Summary
static class Index.Duplicates
           
 
Constructor Summary
Index()
           
Index(String key, Order order)
          Deprecated. use #Index(String, Direction) instead.
Index(String key, Sort.Direction direction)
           
 
Method Summary
 com.mongodb.DBObject getIndexKeys()
           
 com.mongodb.DBObject getIndexOptions()
           
 Index named(String name)
           
 Index on(String key, Order order)
          Deprecated. use #on(String, Direction) instead.
 Index on(String key, Sort.Direction direction)
           
 Index sparse()
          Skip over any document that is missing the indexed field.
 String toString()
           
 Index unique()
          Reject all documents that contain a duplicate value for the indexed field.
 Index unique(Index.Duplicates duplicates)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Index

public Index()

Index

public Index(String key,
             Sort.Direction direction)

Index

@Deprecated
public Index(String key,
                        Order order)
Deprecated. use #Index(String, Direction) instead.

Creates a new Indexed on the given key and Order.

Parameters:
key - must not be null or empty.
order - must not be null.
Method Detail

on

@Deprecated
public Index on(String key,
                           Order order)
Deprecated. use #on(String, Direction) instead.

Adds the given field to the index.

Parameters:
key - must not be null or empty.
order - must not be null.
Returns:

on

public Index on(String key,
                Sort.Direction direction)

named

public Index named(String name)

unique

public Index unique()
Reject all documents that contain a duplicate value for the indexed field.

Returns:
See Also:
http://docs.mongodb.org/manual/core/index-unique/

sparse

public Index sparse()
Skip over any document that is missing the indexed field.

Returns:
See Also:
http://docs.mongodb.org/manual/core/index-sparse/

unique

public Index unique(Index.Duplicates duplicates)
Parameters:
duplicates -
Returns:
See Also:
http://docs.mongodb.org/manual/core/index-creation/#index-creation-duplicate-dropping

getIndexKeys

public com.mongodb.DBObject getIndexKeys()
Specified by:
getIndexKeys in interface IndexDefinition

getIndexOptions

public com.mongodb.DBObject getIndexOptions()
Specified by:
getIndexOptions in interface IndexDefinition

toString

public String toString()
Overrides:
toString in class Object

Spring Data MongoDB - Core

Copyright © 2011-2013-2014 Pivotal. All Rights Reserved.