add a new field to an existing document

29 views
Skip to first unread message

Richard East

unread,
Oct 19, 2014, 7:58:19 AM10/19/14
to clojure...@googlegroups.com
Hi
I've just started using Monger and am not sure on the best solution to add a new field to an existing document.

If I use mc/update-by-id I replace one document for another.

I've tried mc/find-and-modify but get Wrong number of args (8) passed to: collection/find-and-modify

(mc/find-and-modify db tranformations
                        {:_id (Object. id)}
                        {"$set" {:newInformation "newInformation"}}
                        :upsert true
                        :return-new true)

What's the best way to solve this?

Thank you

Michael Klishin

unread,
Oct 19, 2014, 8:37:34 AM10/19/14
to clojure...@googlegroups.com, Richard East
 On 19 October 2014 at 16:36:11, Richard East (richar...@gmail.com) wrote:
> What's the best way to solve this?

$set:
http://clojuremongodb.info/articles/updating.html#using_set_operator
--
@michaelklishin, github.com/michaelklishin

Richard East

unread,
Oct 20, 2014, 6:32:45 AM10/20/14
to clojure...@googlegroups.com, richar...@gmail.com
Thank you.
That was a great help and a lot simpler then I expected.
Reply all
Reply to author
Forward
0 new messages