mongodb - Elixir streaming mondodb fail -


I am using nectar-mongo and am trying to stream the result of a query. Here is the code ...

  def archive_stream (z) are Stream.resource (fn - & gt; {employment, date} = z l = datetime_to_bson_utc datetime c = jobs | & gt; Mongo.Collection .find (% {updated_at:% { "$ lt": lt}}) | & gt; Mongokfind. Aksisi {: cont, c.response.buffer, c} end, fn (z) - & {J, {cont, therest, c}} = front (z) case cont: cont -> {j, {cont, therest, c}}: halt - & gt; {: halt, {cont, Therest, c}} end end, fn (: halt, resp - - gt; resp end)  

end

all sub-bits start working ( Like queries), but when I try to access the stream, I fail ...

  Mdb.archive_stre Am ({jobs, {{2013,11,1}, {0}}}}) | & Gt; Enum.take (2)  

I ...

(BadArityError) # of the function & lt; 2.4 9 475 9 06 1/2 argument with Mdb.archive_stream / 1> Iriyti 2 ({: cont, & lt; 9, 44, 0, 0, 7, 95, 105, 100, 0, 82, 110, 12 9 , 221, 102, 160, 249, 201, 109, 0, 137, 233, 4, 95, 115, 108, 117, 103, 115, 0, 51, 0, 0, 0, 2, 48, 0, 39, 0, 0, 0, 109, 97, 110, 97, 103, 101, 114, 45, ... >>,% Mongo .ursor {batchSize: 0, Archive:% Mongo.Collection {db:% Mongo .Db {Certification: { "admin", "Edd5404c4f906060bl25688e26ffb28l"}, Mongo:% MongokServer {host: 'db-stage.member0.mongolayer .com', id_prefix: 57,602, modes: passive, opt:% { }, Port: 27017, socket: # port & lt; 0.270 99>, timeout: 6000}, name: "db phase", opto:% {mode: idle, timeout: 6000}}, name: "H Bs ", ops:% {}}, tired: wrong, feedback:% Mongo.Response {buffer: 18, 14, 0, 0, 7, 95, 105, 100, 0, 82, 110, 12 9, 221, 102, 160, 249, 201, 109, 0, 137, 242, 4, 95, 115, 108, 117, 103, 115, 0, 45, 0, 0, 2, 48, 0 , 33, 0, 0, 0, 114, 101, 116, 97, ... >>, cursorID: 3958284337526732701, decoder: & amp; Mongo.Response.bson_decode / 1, nbdoc: 101, requestID: 67,280,413, startingFrom: 0}}}) (nectar) lib / stream.ex: 1020: Stream.do_resource / 5 (nectar) lib / enum.ex: 1731: Enum.take / 2

stumped me has been done. any idea? Thanks for the help

Dang! Rookie error

: halt - & gt; {: Stop, {cont, therest, c}} should be _ -> {: Halt, z} and fn (: halt, resp) - & gt; Resp end should be fn (resp) -> Resp end

I am walking with everything but after working for one and a half days.

A little more clarification for fellow rookies

  • The last option in next_fun () might possibly be to catch "code" to other "bad behavior" Not only {: halt}
  • after_fn () is expected only 1 ARG and in the above code which will be z in the last option of next_fun (). It is not expecting to see : halt and z , simply z .

Investing of real experts.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -