2012-02-28 16:11:50 +00:00
|
|
|
## Changes between 1.0.0-beta2 and 1.0.0-beta3
|
|
|
|
|
|
|
|
|
|
### monger.core/set-connection!
|
|
|
|
|
|
|
|
|
|
monger.core/set-connection! allows you to instantiate connection object (com.mongodb.Mongo instances) any
|
|
|
|
|
way you like and then use it as default Monger connection. MongoDB Java driver provides many ways to instantiate
|
|
|
|
|
and fine tune connections, this is the easiest way for Monger to support them all.
|
|
|
|
|
|
|
|
|
|
### 2-arity for monger.core/connect and monger.core/connect!
|
|
|
|
|
|
|
|
|
|
monger.core/connect now has 2-arity that accepts `com.mongodb.ServerAddresss` and `com.mongodb.MongoOptions`
|
|
|
|
|
instances and allows you fine tune parameters like socket and connection timeouts, default `:w` value, connection threads
|
|
|
|
|
settings and so on.
|
|
|
|
|
|
|
|
|
|
`monger.core/mongo-options` and `monger.core/server-address` are helper functions that instantiate those classes from
|
|
|
|
|
paramters passed as Clojure maps, for convenience.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2012-02-12 05:57:53 +00:00
|
|
|
## Changes between 1.0.0-beta1 and 1.0.0-beta2
|
|
|
|
|
|
|
|
|
|
### 3-arity of monger.collection/find-one-as-map now takes a vector of fields
|
|
|
|
|
|
|
|
|
|
3-arity of monger.collection/find-one-as-map now takes a vector of fields
|
|
|
|
|
instead of `keywordize` to better fit a more commonly needed case.
|
|
|
|
|
|
|
|
|
|
``` clojure
|
|
|
|
|
;; 3-arity in 1.0.0-beta1
|
|
|
|
|
(monger.collection/find-one-as-map "documents" { :first_name "John" } false)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
``` clojure
|
|
|
|
|
;; 3-arity in 1.0.0-beta2
|
2012-02-12 06:00:46 +00:00
|
|
|
(monger.collection/find-one-as-map "documents" { :first_name "John" } [:first_name, :last_name, :age])
|
2012-02-12 05:57:53 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If you need to use `keywordize`, use 4-arity:
|
|
|
|
|
|
|
|
|
|
``` clojure
|
2012-02-12 06:00:46 +00:00
|
|
|
(monger.collection/find-one-as-map "documents" { :first_name "John" } [:first_name, :last_name, :age] false)
|
2012-02-12 05:57:53 +00:00
|
|
|
```
|
2012-02-12 06:15:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
### Query DSL has a way to specify if fields need to be keywordized
|
|
|
|
|
|
|
|
|
|
It is now possible to opt-out of field keywordization in the query DSL:
|
|
|
|
|
|
|
|
|
|
``` clojure
|
|
|
|
|
(with-collection coll
|
|
|
|
|
(find {})
|
|
|
|
|
(limit 3)
|
|
|
|
|
(sort { :population -1 })
|
|
|
|
|
(keywordize-fields false))
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
the default value is still true, field names will be converted to keywords.
|
2012-02-13 18:52:53 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
### monger.collection/find-by-id and /find-map-by-id fail fast when id is nil
|
|
|
|
|
|
|
|
|
|
monger.collection/find-by-id and /find-map-by-id now will throw IllegalArgumentException when id is nil
|
2012-02-18 11:22:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
### monger.collection/find-map-by-id no longer ignore fields argument
|
|
|
|
|
|
|
|
|
|
monger.collection/find-map-by-id no longer ignore fields argument. Contributed by Toby Hede.
|
2012-02-18 12:01:43 +00:00
|
|
|
|
|
|
|
|
|
2012-02-21 11:09:58 +00:00
|
|
|
### Meet monger.db and monger.command
|
2012-02-18 12:01:43 +00:00
|
|
|
|
|
|
|
|
`monger.db` namespace was added to perform operations like adding users or dropping databases. Several functions from
|
2012-02-21 11:09:58 +00:00
|
|
|
`monger.core` will eventually be moved there, but not for 1.0.
|
|
|
|
|
|
|
|
|
|
`monger.command` namespace includes convenience methods for issuing MongoDB commands.
|
|
|
|
|
|
|
|
|
|
Both are contributed by Toby Hede.
|
2012-02-18 14:56:34 +00:00
|
|
|
|
|
|
|
|
|
2012-02-18 15:02:43 +00:00
|
|
|
### New convenience functions: monger.collection/update-by-id, /remove-by-id
|
2012-02-18 14:56:34 +00:00
|
|
|
|
2012-02-18 15:02:43 +00:00
|
|
|
`monger.collection/update-by-id` is a new convenience function for updating a single document with
|
|
|
|
|
given ObjectId. `monger.collection/remove-by-id` is its counterpart for removing documents.
|
2012-02-20 12:06:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
### monger.core/get-db-names
|
|
|
|
|
|
|
|
|
|
monger.core/get-db-names returns a set of databases. Contributed by Toby Hede.
|
2012-02-21 11:09:58 +00:00
|
|
|
|