module Moongoon
Overview
Moongoon is a MongoDB object-document mapper library.
Extended Modules
Defined in:
config.crmodels/models.cr
moongoon.cr
Constant Summary
-
Log =
::Log.for(self)
Class Method Summary
-
.client : Mongo::Client
Retrieves the mongodb driver client that can be used to perform low level queries
-
.client? : Mongo::Client | Nil
Retrieves the mongodb driver client that can be used to perform low level queries
- .config
- .configure(&)
-
.database : Mongo::Database
The default database instance that can be used to perform low level queries.
-
.database_name : String
The name of the default database.
-
.database_name? : String | Nil
The name of the default database.
Class Method Detail
def self.client : Mongo::Client
#
Retrieves the mongodb driver client that can be used to perform low level queries
See: https://github.com/elbywan/cryomongo
cursor = Moongoon.client["database"]["collection"].find({ "key": value })
puts cursor.to_a
def self.client? : Mongo::Client | Nil
#
Retrieves the mongodb driver client that can be used to perform low level queries
See: https://github.com/elbywan/cryomongo
cursor = Moongoon.client["database"]["collection"].find({ "key": value })
puts cursor.to_a
def self.database : Mongo::Database
#
The default database instance that can be used to perform low level queries.
See: https://github.com/elbywan/cryomongo
db = Moongoon.database
collection = db["some_collection"]
data = collection.find query
pp data