class MongoDB extends AnyRef
Wrapper for the Mongo DB
object providing scala-friendly functionality.
- Since
1.0
- See also
com.mongodb.DB
- Alphabetic
- By Inheritance
- MongoDB
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new MongoDB(underlying: DB)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
addOption(option: Int): Unit
Manipulate Network Options
Manipulate Network Options
- See also
com.mongodb.Bytes
com.mongodb.Mongo
-
def
apply(collection: String): MongoCollection
Apply method to proxy getCollection, to allow invocation of
dbInstance("collectionName")
instead of getCollectionApply method to proxy getCollection, to allow invocation of
dbInstance("collectionName")
instead of getCollection- collection
a string for the collection name
- returns
MongoCollection A wrapped instance of a Mongo DBCollection Class returning generic DBObjects
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
collectionExists(collectionName: String): Boolean
Checks to see if a collection by name %lt;name> exists.
Checks to see if a collection by name %lt;name> exists.
- collectionName
The collection to test for existence
- returns
false if no collection by that name exists, true if a match to an existing collection was found
-
def
collectionNames(): Set[String]
Returns a set of the names of collections in this database.
Returns a set of the names of collections in this database.
- returns
the names of collections in this database
-
def
command(cmd: Imports.DBObject, readPreference: Imports.ReadPreference): CommandResult
Execute a database command directly.
Execute a database command directly.
- returns
the result of the command from the database
- See also
-
def
command(cmd: String): CommandResult
Execute a database command directly.
Execute a database command directly.
- returns
the result of the command from the database
- See also
-
def
command(cmd: Imports.DBObject): CommandResult
Execute a database command directly.
Execute a database command directly.
- returns
the result of the command from the database
- See also
-
def
createCollection(name: String, o: Imports.DBObject): DBCollection
Creates a collection with a given name and options.
Creates a collection with a given name and options. If the collection does not exist, a new collection is created. Possible options: <dl> <dt>capped</dt>
- boolean: if the collection is capped
<dt>size</dt>- int: collection size
<dt>max</dt>- int: max number of documents
</dl>- name
the name of the collection to return
- o
options
- returns
the collection
- def doEval(code: String, args: AnyRef*): CommandResult
-
def
dropDatabase(): Unit
Drops this database.
Drops this database. Removes all data on disk. Use with caution.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def eval(code: String, args: AnyRef*): AnyRef
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
getCollection(name: String): DBCollection
Gets a collection with a given name.
Gets a collection with a given name. If the collection does not exist, a new collection is created.
- name
(String) the name of the collection to return
- returns
the collection
-
def
getCollectionFromString(s: String): DBCollection
Returns a collection matching a given string.
Returns a collection matching a given string.
- s
the name of the collection
- returns
the collection
-
def
getCollectionNames(): Set[String]
Returns a set of the names of collections in this database.
Returns a set of the names of collections in this database.
- returns
the names of collections in this database
- def getName: String
-
def
getOptions: Int
Manipulate Network Options
Manipulate Network Options
- See also
com.mognodb.Bytes
com.mongodb.Mongo
-
def
getReadPreference: Imports.ReadPreference
Gets the read preference for this database.
Gets the read preference for this database. Will be used as default for reads from any collection in this database. See the documentation for com.mongodb.ReadPreference for more information.
- def getSisterDB(name: String): MongoDB
- def getStats(): CommandResult
-
def
getWriteConcern: Imports.WriteConcern
get the write concern for this database, which is used for writes to any collection in this database.
get the write concern for this database, which is used for writes to any collection in this database. See the documentation for com.mongodb.WriteConcern for more info.
- See also
WriteConcern
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
mapReduce(cmd: map_reduce.MapReduceCommand): MapReduceResult
The Java Driver is a bit outdated and is missing the finalize option.
The Java Driver is a bit outdated and is missing the finalize option. Additionally, it returns ZERO information about the actual results of the mapreduce, just a cursor to the result collection. This is less than ideal. So I've wrapped it in something more useful.
- cmd
An instance of MapReduceCommand representing the required MapReduce
- returns
MapReduceResult a wrapped result object. This contains the returns success, counts etc, but implements iterator and can be iterated directly
- def name: String
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
def
options: Int
Manipulate Network Options
Manipulate Network Options
- See also
com.mognodb.Bytes
com.mongodb.Mongo
-
def
readPreference: Imports.ReadPreference
Gets the read preference for this database.
Gets the read preference for this database. Will be used as default for reads from any collection in this database. See the documentation for com.mongodb.ReadPreference for more information.
-
def
readPreference_=(pref: Imports.ReadPreference): Unit
Sets the read preference for this database.
Sets the read preference for this database. Will be used as default for reads from any collection in this database. See the documentation for com.mongodb.ReadPreference for more information.
- pref
Read Preference to use
-
def
resetOptions(): Unit
Manipulate Network Options
Manipulate Network Options
- See also
com.mongodb.Bytes
com.mongodb.Mongo
-
def
setReadPreference(pref: Imports.ReadPreference): Unit
Sets the read preference for this database.
Sets the read preference for this database. Will be used as default for reads from any collection in this database. See the documentation for com.mongodb.ReadPreference for more information.
- pref
Read Preference to use
-
def
setWriteConcern(concern: Imports.WriteConcern): Unit
Set the write concern for this database.
Set the write concern for this database. Will be used for writes to any collection in this database. See the documentation for com.mongodb.WriteConcern for more info.
- concern
(WriteConcern) The write concern to use
- See also
http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
WriteConcern
- def stats(): CommandResult
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- MongoDB → AnyRef → Any
- val underlying: DB
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
writeConcern: Imports.WriteConcern
get the write concern for this database, which is used for writes to any collection in this database.
get the write concern for this database, which is used for writes to any collection in this database. See the documentation for com.mongodb.WriteConcern for more info.
- See also
http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
WriteConcern
-
def
writeConcern_=(concern: Imports.WriteConcern): Unit
Set the write concern for this database.
Set the write concern for this database. Will be used for writes to any collection in this database. See the documentation for com.mongodb.WriteConcern for more info.
- concern
(WriteConcern) The write concern to use
- See also
http://www.thebuzzmedia.com/mongodb-single-server-data-durability-guide/
WriteConcern
Deprecated Value Members
-
def
slaveOk(): Unit
Sets queries to be OK to run on slave nodes.
Sets queries to be OK to run on slave nodes.
- Annotations
- @deprecated @SuppressWarnings()
- Deprecated
(Since version 2.3.0) Replaced with ReadPreference.SECONDARY.