zookzook / elixir-mongodb-driver

MongoDB driver for Elixir
Apache License 2.0
245 stars 63 forks source link

Error if mongo URL has readPreference, but no readPreferenceTags #212

Closed JohannesSoots closed 11 months ago

JohannesSoots commented 1 year ago

Hi! When passing readPreference in mongo url without readPreferenceTags also in the url then getting following error:

 ** (FunctionClauseError) no function clause matching in String.split/3    

     The following arguments were given to String.split/3:

         # 1
         []

         # 2
         ","

         # 3
         []

     (elixir 1.14.0) lib/string.ex:479: String.split/3
     (mongodb_driver 1.2.0) lib/mongo/url_parser.ex:241: Mongo.UrlParser.parse_tags/1
     (mongodb_driver 1.2.0) lib/mongo/url_parser.ex:220: Mongo.UrlParser.extend_read_preference_tags/2
     (mongodb_driver 1.2.0) lib/mongo/url_parser.ex:207: Mongo.UrlParser.process_read_preferences/1
     (mongodb_driver 1.2.0) lib/mongo/url_parser.ex:186: Mongo.UrlParser.parse_url/1
     (mongodb_driver 1.2.0) lib/mongo.ex:140: Mongo.start_link/1

Related to #206

zookzook commented 1 year ago

It is fixed in the master branch: https://github.com/zookzook/elixir-mongodb-driver/commit/50ea98db82217bbd9a2f37ad57f6f271b2bff7c2

Feel free to check it!

zookzook commented 11 months ago

Closing due to no response.