Commit graph

420 commits

Author SHA1 Message Date
eunmin
df09c4085d Add operator 2016-08-19 14:19:50 +09:00
eunmin
ccffffc912 Add missing MongoClientOptions 2016-07-07 21:17:59 +09:00
Samsonov Ivan
2b4c0f8168 Fix keywordize param for find-map-by-id 2016-04-26 19:03:44 +03:00
Divyansh Prakash
5916642b2b Fix reflection warnings. 2016-04-07 16:52:02 +05:30
Torsten Uhlmann
9d51f32fa1 Fixing call to find-map-by-id, threw a ClassCastException
Fixes #131
2016-03-27 13:07:38 +02:00
Michael Klishin
c7a87ac776 Merge branch 'typehint' of https://github.com/boechat107/monger into boechat107-typehint 2016-01-16 14:25:50 +03:00
Andre Ambrosio Boechat
bdecd98b40 with-collection macro: type hints improvement
From all the resources I found about type hinting in macros,
it doesn't work like it does for normal functions.

I got reflection warnings for a code like this:

```clj
(let [conn (mg/connect)
      db (delay (mg/get-db conn "monger-test"))]
  (with-collection @db "something"
    (find {})))
```

The type hint for `db` didn't work. Actually the type hint that works
comes from the function `core/get-db` and we see this when we remove
`delay` from the code above. As we could expect, the function `deref`
doesn't propagate the type hint.

I did similar tests with the collection name and no reflection warning
was raised for any case. In addition, it looked weird for me to have
a type hint like `^String` and then a checking like `string?` later.

Some references:

* http://stackoverflow.com/questions/11919602/generating-clojure-code-with-type-hints
* Clojure High Performance Programming, page 44.
2016-01-15 15:47:47 +01:00
Stijn Opheide
b0df70f279 Fix cursor hinting
The .hint method should be applied on the cursor object instead
of the DBObject contained in the hint field.
2016-01-06 12:00:08 +01:00
Juho Teperi
1299e5e5ff Remove from-db-object implementation for Map
It should be enough that from-db-object is implemented for DBObject
2015-10-09 00:49:28 +03:00
Juho Teperi
c26ae0835d Optimize from-db-object performance for DBObjects
Creating temporary sequence from DBObject is quite slow. Using
.keySet for reduce collection and calling .get inside reduce is
considerably faster. The common code between Map and DBObject
implementations can't be shared as reflection would completely kill the
performance and function can't be type hinted as DBObject doesn't
implement Map interface.

Added a simple test case for the from-db-object performance. I'm seeing
performance increase of 20% on this (170ms -> 140ms).
2015-10-08 22:59:47 +03:00
Artem Chistyakov
8316e7798e Don’t forget to pass credentials to MongoClient
It looks like provided credentials are ignored unless `server-address` is a collection.
2015-09-18 16:07:01 -04:00
Andrei Biasprozvanny
ebc01b3f54 Find-maps now supports keywordize option 2015-08-25 16:48:17 +01:00
Erik Bakstad
d9b103c350 Removed call to removed MongoClientOptions.Builder methods 2015-07-22 21:38:41 +02:00
Michael Klishin
51baa3e154 Adhere to the existing code style 2015-06-27 23:16:11 +03:00
Michael Klishin
4ff7d05aa4 monger.credentials/for => monger.credentials/create
To make sure we don't shadow clojure.core/for when monger.credentials
is required with :refer :all.
2015-06-27 22:39:01 +03:00
Bartek Marcinowski
15f50408a9 Merge branch 'add_options_to_aggregate'
Merge implementation of aggregation framework options and explanation of
aggregation query plan.

Conflicts:
	src/clojure/monger/collection.clj
2015-06-24 16:05:47 +01:00
Bartek Marcinowski
f0946acd75 Enable query plan explanation for the aggregation framework
Add the explain-aggregate function, which returns a map containing
information about the given aggregation query.
2015-06-24 15:51:24 +01:00
Bartek Marcinowski
136dea00b2 Add allow-disk-use and cursor options to aggregate
Reimplement aggregate on top of the Java driver's DBCollection#aggregate
in order to return a cursor for the results. This allows users to
overcome the 16MB result size limit and specify the cursor batch size.
The allowDiskUse can also be passed to Mongo, through the allow-disk-use
key. The maxTime option enables setting a limit (in milliseconds) on the
execution time of the query, through the max-time key.
2015-06-24 15:47:46 +01:00
Joshua Karstendick
9c0f385ab2 Fixes a bug with the 5-arity ensure-index function. The argument
named `name` shadowed clojure.core/name, so trying to call `name`
as a function on line 426 throws an exception. Fixes the bug by
renaming the argument to `index-name`.
2015-06-23 17:21:12 -04:00
Michael Klishin
94029c7f6c Support aggregation options, closes #102 2015-06-23 22:01:06 +03:00
Ivan Samsonov
126c9f8503 Connect via uri in core/connect if it is passed
core/connect ignores :uri key and tries to connect 127.0.0.1:27017 instead.
Patch fix this behaviour by checking uri key existance and trying to connect
by uri if it's provided.
2015-06-15 02:45:11 +03:00
Michael Klishin
a2b1ddb054 Update license headers 2015-06-06 19:15:01 +03:00
Michael Klishin
5651c2ee97 This is no longer necessary
Since we no longer support Clojure 1.3.
2015-05-18 06:33:16 -07:00
Tom McMillen
602b6e3ce9 Add JSON serialization of BSONTimestamp 2015-05-17 13:27:40 -07:00
Michael Klishin
3e71b6ffc7 Commit monger.credentials 2015-05-17 18:53:14 +03:00
Michael Klishin
8b2fd956e4 Rework authentication for the 3.0 client and multiple server versions
When authentication failures, MongoDB Java client throws a timeout
exception whose cause is a failed command exception which carries
a reason. Still not great at authentication failure notification.
2015-05-17 18:51:44 +03:00
Michael Klishin
6ca5b9d4ba monger.search is gone
Full text search in 3.0 is supported via regular queries
with the $text operator.
2015-05-16 15:38:41 +03:00
Michael Klishin
a107f1f8b7 Adapt for Java driver 3.0 2015-05-11 01:36:24 +03:00
Michael Klishin
3c63209ab1 Make sure hint isn't set to nil
MongoDB 3.0 is not as lenient about it.
2015-05-11 01:20:56 +03:00
Michael Klishin
05dd57731a Adapt to 3.0 2015-05-11 01:20:18 +03:00
Michael Klishin
26be7bb1b9 Make command-test pass 2015-05-11 01:19:47 +03:00
Michael Klishin
0b72761b44 Adapt monger.{core,collection} and tests to recent changes
Down to 50 failures and 11 errors in `lein test`.
2015-02-22 19:26:27 +03:00
Michael Klishin
8511d3714d Reduce monger.result to two functions: acknowledged? and
`updated-existing?`

`ok?` and other variations are now all superceded by `acknowledged?`,
`WriteConcern/ACKNOWLEDGED` is the recommended way of ensuring safe
writes.
2015-02-22 19:24:51 +03:00
Michael Klishin
d9e6be671a Monger's DBRef cannot work with com.mongodb.DBRef without fundamental re-thinking
com.mongodb.DBRef#fetch was removed.
2015-02-22 19:24:10 +03:00
Michael Klishin
2128f2cd6c getLastError is gone in the 3.0 driver 2015-02-22 18:52:31 +03:00
Michael Klishin
a1f3566632 Correct docstring example 2014-11-19 15:16:52 +00:00
Robin Heggelund Hansen
1c62587165 Fixes #77: Add update-by-ids function to mongo.collection 2014-10-21 06:06:06 +02:00
Stijn Opheide
b0accb8447 Exclude clojure.core/update from monger.collection.
clojure.core/update was introduced in clojure 1.7. To avoid clashing
with monger.collection/update it has to be excluded in the latter
namespace.
2014-10-17 13:04:37 +04:00
Michael Klishin
2c05d4c9d5 Remove the deprecation note since it is only confusing these days 2014-10-11 03:40:40 +04:00
Robin Heggelund Hansen
00dad8d0fb Allow object-id to convert string to object-id 2014-08-07 01:23:30 +02:00
Juha Jokimäki
2c019e5e91 Support for $each modifier 2014-07-18 14:47:37 +03:00
Michael Klishin
f846cd0a51 Make mongo-options take a map instead of pseudo-kwards, extract mongo-options-builder 2014-06-15 17:39:32 +04:00
Michael Klishin
59427e29bb Cosmetics 2014-06-15 17:31:35 +04:00
Michael Klishin
e8b5ba5dd6 Cosmetics 2014-06-15 17:29:31 +04:00
Deamon Wang
6330cee24a fix doc error for update 2014-05-18 12:10:05 +08:00
Michael Klishin
6206308fa8 WriteConcern/SAFE was renamed (and is the default, so not very demonstrative) 2014-05-13 05:06:23 +04:00
Michael Klishin
d7902c9618 Query DSL tests now pass 2014-05-11 13:10:56 -04:00
Michael Klishin
9752950d82 Add extra arities to several update functions 2014-05-11 12:50:15 -04:00
Michael Klishin
a3954f3847 Require options in monger.collection to be maps (pseudo-kwargs are no longer supported) 2014-05-10 17:55:28 -04:00
Michael Klishin
b1e874aa87 monger.fn can go now since we rely on ClojureWerkz Support 2014-05-10 17:43:43 -04:00