Packages

object Indexes

A factory for defining index keys. A convenient way to use this class is to statically import all of its methods, which allows usage like:

collection.createIndex(compoundIndex(ascending("x"), descending("y")))
Since

1.0

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Indexes
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Value Members

  1. def ascending(fieldNames: String*): Bson

    Create an index key for an ascending index on the given fields.

    Create an index key for an ascending index on the given fields.

    fieldNames

    the field names, which must contain at least one

    returns

    the index specification

    See also

    indexes

  2. def compoundIndex(indexes: Bson*): Bson

    create a compound index specifications.

    create a compound index specifications. If any field names are repeated, the last one takes precedence.

    indexes

    the index specifications

    returns

    the compound index specification

    See also

    compoundIndex

  3. def descending(fieldNames: String*): Bson

    Create an index key for an ascending index on the given fields.

    Create an index key for an ascending index on the given fields.

    fieldNames

    the field names, which must contain at least one

    returns

    the index specification

    See also

    indexes

  4. def geo2d(fieldName: String): Bson

    Create an index key for a 2d index on the given field.

    Create an index key for a 2d index on the given field.

    Note: A 2d index is for data stored as points on a two-dimensional plane. The 2d index is intended for legacy coordinate pairs used in MongoDB 2.2 and earlier.

    fieldName

    the field to create a 2d index on

    returns

    the index specification

    See also

    2d index

  5. def geo2dsphere(fieldNames: String*): Bson

    Create an index key for an 2dsphere index on the given fields.

    Create an index key for an 2dsphere index on the given fields.

    fieldNames

    the field names, which must contain at least one

    returns

    the index specification

    See also

    2dsphere Index

  6. def hashed(fieldName: String): Bson

    Create an index key for a hashed index on the given field.

    Create an index key for a hashed index on the given field.

    fieldName

    the field to create a hashed index on

    returns

    the index specification

    See also

    hashed index

  7. def text(fieldName: String): Bson

    Create an index key for a text index on the given field.

    Create an index key for a text index on the given field.

    fieldName

    the field to create a text index on

    returns

    the index specification

    See also

    text index