You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compatibility changes to support mongodb_ecto adapter (#227)
* Add BSON encoders for Elixir Date/NaiveDateTime
* Return FindAndModifyResult struct from appropriate operations
* Fix conflation of application `log` env var and function option of the same name
The application env variable called `log` is meant to be either a boolean or atom log level, whereas the function option called `log` is potentially a function or MFA tuple that is passed down to DBConnection.
* Add generic Mongo.update/4 function
This function is copied from the older `mongodb` driver for compatibility with the ecto adapter
* Update tests for functions returning FindAndModifyResult
* Mix format
* Update array_filters test for FindAndModifyResult structs
assert{:ok,nil}==Mongo.find_one_and_update(c.pid,coll,%{"number"=>666},%{"$set"=>%{title: "the number of the beast"}})
257
+
assert{:ok,%Mongo.FindAndModifyResult{matched_count: 0,updated_existing: false,value: nil}}==Mongo.find_one_and_update(c.pid,coll,%{"number"=>666},%{"$set"=>%{title: "the number of the beast"}})
258
258
259
-
assert{:ok,nil}==Mongo.find_one_and_update(c.pid,"coll_that_doesnt_exist",%{"number"=>666},%{"$set"=>%{title: "the number of the beast"}})
259
+
assert{:ok,%Mongo.FindAndModifyResult{matched_count: 0,updated_existing: false,value: nil}}==Mongo.find_one_and_update(c.pid,"coll_that_doesnt_exist",%{"number"=>666},%{"$set"=>%{title: "the number of the beast"}})
260
260
261
261
# wrong parameter
262
262
assert{:error,%Mongo.Error{}}=Mongo.find_one_and_update(c.pid,2,%{"number"=>666},%{"$set"=>%{title: "the number of the beast"}})
0 commit comments