Class

com.mongodb.casbah

MongoGenericTypedCursor

Related Doc: package casbah

Permalink

class MongoGenericTypedCursor[A <: casbah.Imports.DBObject] extends MongoCursorBase

Concrete cursor implementation for typed Cursor operations via Collection.setObjectClass This is a special case cursor for typed operations.

A

A Subclass of DBObject

Version

2.0, 12/23/10

Since

1.0

Linear Supertypes
MongoCursorBase, Logging, AnyRef, Any
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. MongoGenericTypedCursor
  2. MongoCursorBase
  3. Logging
  4. AnyRef
  5. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Instance Constructors

  1. new MongoGenericTypedCursor(underlying: DBCursor)

    Permalink

    underlying

    (com.mongodb.DBCollection)

Type Members

  1. type T = A

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def $explain(bool: Boolean = true): MongoGenericTypedCursor.this.type

    Permalink

    $explain

    $explain

    Sets a special operator of $explain which, if true, explains the query instead of returning results.

    This is the same as calling the explain() method on the cursor.

    bool

    (Boolean = true)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  4. def $hint[A](obj: A)(implicit arg0: (A) ⇒ Imports.DBObject): MongoGenericTypedCursor.this.type

    Permalink

    $hint

    $hint

    Sets a special operator $hint which forces the query to use a given index.

    This is the same as calling hint() on the cursor.

    obj

    (DBObject)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  5. def $max[A](obj: A)(implicit arg0: (A) ⇒ Imports.DBObject): MongoGenericTypedCursor.this.type

    Permalink

    $max

    $max

    Sets maximum index bounds - commonly paired with $max

    obj

    (DBObject)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
    See also

    http://www.mongodb.org/display/DOCS/max+and+max+Query+Specifiers

  6. def $maxScan[A](max: T)(implicit arg0: Numeric[A]): MongoGenericTypedCursor.this.type

    Permalink

    $maxScan

    $maxScan

    Sets a special operator of $maxScan Which defines the max number of items to scan.

    A

    : Numeric

    max

    (A)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  7. def $min[A](obj: A)(implicit arg0: (A) ⇒ Imports.DBObject): MongoGenericTypedCursor.this.type

    Permalink

    $min

    $min

    Sets minimum index bounds - commonly paired with $max

    obj

    (DBObject)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
    See also

    http://www.mongodb.org/display/DOCS/min+and+max+Query+Specifiers

  8. def $orderby[A](obj: A)(implicit arg0: (A) ⇒ Imports.DBObject): MongoGenericTypedCursor.this.type

    Permalink

    $orderby

    $orderby

    Sets a special operator of $orderby which defines the sort spec for this cursor.

    This is the same as calling sort on the cursor.

    obj

    (DBObject)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  9. def $query[A](q: A)(implicit arg0: (A) ⇒ Imports.DBObject): MongoGenericTypedCursor.this.type

    Permalink

    $query

    $query

    Sets a special operator of $query Which defines the query for this cursor.

    This is the same as running find() on a Collection with the query.

    q

    (DBObject)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  10. def $returnKey(bool: Boolean = true): MongoGenericTypedCursor.this.type

    Permalink

    $returnKey

    $returnKey

    Sets a special operator of $returnKey If true, returns ONLY the index key. Defaults to true if you just call $returnKey

    bool

    (Boolean = true)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  11. def $showDiskLoc(bool: Boolean = true): MongoGenericTypedCursor.this.type

    Permalink

    $showDiskLoc

    $showDiskLoc

    Sets a special operator $showDiskLoc which, if true, shows the disk location of results.

    bool

    (Boolean = true)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  12. def $snapshot(bool: Boolean = true): MongoGenericTypedCursor.this.type

    Permalink

    $snapshot

    $snapshot

    Sets a special operator of $snapshot which, if True, sets snapshot mode on the query.

    This is the same as calling the snapshot() method on the cursor.

    bool

    (Boolean = true)

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  13. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  14. def _newInstance(cursor: DBCursor): MongoGenericTypedCursor[T]

    Permalink

    _newInstance

    _newInstance

    Utility method which concrete subclasses are expected to implement for creating a new instance of THIS concrete implementation from a Java cursor. Good with cursor calls that return a new cursor.

    cursor

    (DBCursor)

    returns

    (this.type)

    Definition Classes
    MongoGenericTypedCursorMongoCursorBase
  15. def addSpecial(name: String, o: Any): MongoGenericTypedCursor.this.type

    Permalink

    "Special" Operators for cursors

    "Special" Operators for cursors

    adds a special operator like $maxScan or $returnKey

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
    See also

    http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-Specialoperators { @inheritDoc}

  16. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  17. def batchSize(n: Int): MongoCursorBase

    Permalink

    batchSize

    batchSize

    Limits the number of elements returned in one batch.

    n

    (Int) The number of elements to return in a batch

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  18. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  19. def close(): Unit

    Permalink

    close

    close

    Kill the current cursor on the server

    Definition Classes
    MongoCursorBase
  20. def copy(): MongoGenericTypedCursor[T]

    Permalink

    copy

    copy

    Creates a new copy of an existing database cursor. The new cursor is an iterator even if the original was an array.

    returns

    The new cursor

    Definition Classes
    MongoGenericTypedCursorMongoCursorBase
  21. def count(): Int

    Permalink

    count

    count

    The DBCursor's count of elements in the query, passed through from the Java object. Note that Scala Iterator[_] base trait has a count method which tests predicates and you should be careful about using that.

    NOTE: count() ignores any skip/limit settings on a cursor; it is the count of the ENTIRE query results. If you want to get a count post-skip/limit you must use size()

    returns

    Int indicating the number of elements returned by the query

    Definition Classes
    MongoCursorBase
    Exceptions thrown
    See also

    size()

  22. def cursorId: Long

    Permalink

    cursorId

    cursorId

    returns

    A long representing the cursorID on the server; 0 = no cursor

    Definition Classes
    MongoCursorBase
  23. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  24. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  25. def explain: CursorExplanation

    Permalink

    explain

    explain

    Returns an object containing basic information about the execution of the query that created this cursor. This creates an instance of CursorExplanation which is a custom dbObject with the key/value pairs: - cursor = Cursor Type - nscanned = Number of items examined by Mongo for this query - nscannedObjects = Number of objects examined by Mongo - n = the number of records which Mongo returned - millis = how long it took Mongo to execute the query - nYields = number of times this query yielded the read lock to let writes in - indexBounds = the index boundaries used.

    CursorExplanation provides utility methods to access these fields.

    returns

    an instance of CursorExplanation

    Definition Classes
    MongoCursorBase
    See also

    http://dochub.mongodb.org/core/explain

  26. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  27. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  28. def hasNext: Boolean

    Permalink

    hasNext

    hasNext

    Is there another element in the cursor?

    <invalid inheritdoc annotation>

    returns

    (Boolean Next)

    Definition Classes
    MongoCursorBase
  29. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  30. def hint(indexName: String): MongoGenericTypedCursor.this.type

    Permalink

    hint

    hint

    Provide the Database a hint of an indexed field of a collection to use to improve performance.

    indexName

    (String) The name of an index

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  31. def hint[A](indexKeys: A)(implicit arg0: (A) ⇒ Imports.DBObject): MongoGenericTypedCursor.this.type

    Permalink

    hint

    hint

    Provide the Database a hint of which indexed fields of a collection to use to improve performance.

    A

    A view of DBObject to use for the indexKeys

    indexKeys

    (A) A DBObject of the index names as keys

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  32. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  33. def keysWanted: Imports.DBObject

    Permalink
    Definition Classes
    MongoCursorBase
  34. def limit(n: Int): MongoGenericTypedCursor.this.type

    Permalink

    limit

    limit

    Limits the number of elements returned.

    NOTE: Specifying a negative number instructs the server to retrun that number of items and close the cursor. It will only return what can fit into a single 4MB response

    n

    (Int) The number of elements to return

    returns

    A cursor pointing to the first element of the limited results

    Definition Classes
    MongoCursorBase
    See also

    http://dochub.mongodb.org/core/limit

  35. var log: Logger

    Permalink
    Attributes
    protected[com.mongodb.casbah]
    Definition Classes
    Logging
  36. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  37. def next(): T

    Permalink

    next

    next

    Iterator increment.

    TODO: The cast to T should be examined for sanity/safety.

    <invalid inheritdoc annotation>

    returns

    The next element in the cursor

    Definition Classes
    MongoCursorBase
  38. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  39. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  40. def numSeen: Int

    Permalink

    numSeen

    numSeen

    Returns the number of objects through which this cursor has iterated, as tracked by the java driver.

    returns

    The number of objects seen

    Definition Classes
    MongoCursorBase
  41. def option: Int

    Permalink

    Manipulate Query Options

    Manipulate Query Options

    Gets current option settings - see Bytes.QUERYOPTION_* for list

    Definition Classes
    MongoCursorBase
    See also

    com.mongodb.Bytes

    com.mongodb.Mongo

  42. def option_=(option: Int): Unit

    Permalink

    Manipulate Query Options

    Manipulate Query Options

    Adds an option - see Bytes.QUERYOPTION_* for list TODO - Create Scala version of Bytes.QUERYOPTION_*

    Definition Classes
    MongoCursorBase
    See also

    com.mongodb.Bytes

    com.mongodb.Mongo

  43. def options: Int

    Permalink

    Manipulate Query Options

    Manipulate Query Options

    Gets current option settings - see Bytes.QUERYOPTION_* for list

    Definition Classes
    MongoCursorBase
    See also

    com.mongodb.Bytes

    com.mongodb.Mongo

  44. def options_=(opts: Int): Unit

    Permalink

    Manipulate Query Options

    Manipulate Query Options

    Sets current option settings - see Bytes.QUERYOPTION_* for list

    Definition Classes
    MongoCursorBase
    See also

    com.mongodb.Bytes

    com.mongodb.Mongo

  45. def query: Imports.DBObject

    Permalink
    Definition Classes
    MongoCursorBase
  46. def resetOptions(): DBCursor

    Permalink

    Manipulate Query Options

    Manipulate Query Options

    Resets options to default.

    Definition Classes
    MongoCursorBase
    See also

    com.mongodb.Bytes

    com.mongodb.Mongo

  47. def skip(n: Int): MongoGenericTypedCursor.this.type

    Permalink

    skip

    skip

    Discards a given number of elements at the beginning of the cursor.

    n

    (Int) The number of elements to skip

    returns

    A cursor pointing to the first element of the results

    Definition Classes
    MongoCursorBase
    See also

    http://dochub.mongodb.org/core/skip

  48. def snapshot(): MongoGenericTypedCursor.this.type

    Permalink

    Use snapshot mode for the query.

    Use snapshot mode for the query. Snapshot mode prevents the cursor from returning a document more than once because an intervening write operation results in a move of the document. Even in snapshot mode, documents inserted or deleted during the lifetime of the cursor may or may not be returned. Currently, snapshot mode may not be used with sorting or explicit hints.

    returns

    the same DBCursor, useful for chaining operations

    Definition Classes
    MongoCursorBase
  49. def sort[A](orderBy: A)(implicit arg0: (A) ⇒ Imports.DBObject): MongoGenericTypedCursor.this.type

    Permalink

    sort

    sort

    Sort this cursor's elements

    A

    A view of DBObject to sort by

    orderBy

    (A) The fields on which to sort

    returns

    A cursor pointing to the first element of the sorted results

    Definition Classes
    MongoCursorBase
  50. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  51. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  52. val underlying: DBCursor

    Permalink

    (com.mongodb.DBCollection)

    (com.mongodb.DBCollection)

    Definition Classes
    MongoGenericTypedCursorMongoCursorBase
  53. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  54. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  55. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Deprecated Value Members

  1. def slaveOk(): DBCursor

    Permalink

    slaveOk

    slaveOk

    Makes this query OK to run on a non-master node.

    Definition Classes
    MongoCursorBase
    Annotations
    @deprecated @SuppressWarnings()
    Deprecated

    (Since version 2.3.0) Replaced with ReadPreference.SECONDARY

Inherited from MongoCursorBase

Inherited from Logging

Inherited from AnyRef

Inherited from Any

Ungrouped