So does no one here use congomongo?

On Sat, Jul 10, 2010 at 1:17 PM, Mark Engelberg
<mark.engelb...@gmail.com> wrote:
> Let's say I have a table called :table, and a column called :col, and
> I want to go through all the records in the table and set the :col
> value to 0.  I had been doing it like this:
> (defn update-db! []
>  (doseq [entry (fetch :table)]
>    (update! :table entry (assoc entry :col 0))))
>
> but the other day I noticed that this was mysteriously skipping over
> certain records, and not everything was getting updated.  So I
> switched to this:
>
> (defn update-db! []
>  (doseq [entry (doall (fetch :table))]
>    (update! :table entry (assoc entry :col 0))))
>
> which worked just fine.  I speculate that somehow the update process
> screws with whatever iteration process that fetch uses to deliver the
> records lazily.  However, now my update process is limited by the
> number of records I can hold in memory.
>
> So, is there some sort of recipe for updating all records without
> first loading them all into memory?
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to