How to use $position to unshift, insert and replace elements onto an array

126 views
Skip to first unread message

Ben McFerren

unread,
Nov 13, 2015, 1:40:33 PM11/13/15
to Monger, a Clojure MongoDB driver
I am trying to edit an array but I can only find mechanisms to push (single element or an array of elements) onto the end of an array with Monger

From looking at the Mongo api, there seems to be a $position operator but I cannot find out how to use it from the Monger docs:


Can you please help me with the syntax to unshift, insert and replace elements onto an array (either a single element or an array of elements)

I am very grateful from help you can offer.

All the best,

Ben

Michael Klishin

unread,
Nov 13, 2015, 1:43:07 PM11/13/15
to Monger, a Clojure MongoDB driver
Exactly as in Mongo shell. That's the key feature of Monger: it does not have its own syntax,
you simply translate Mongo shell examples into Clojure (using Clojure data structures). That's it.
Reply all
Reply to author
Forward
0 new messages