mongodb-erlang icon indicating copy to clipboard operation
mongodb-erlang copied to clipboard

How to append to an array

Open sammyraul opened this issue 7 years ago • 1 comments

Example in README

Command = #{<<"$set">> => #{
    <<"tags.1">> => "rain gear"
  }},
mc_worker_api:update(Connection, Collection, #{'_id' => 100}, Command),

just replaces the element at the 1st position. What I wanted is add the element at the start or end. Using "-1" does not work. Any help would be highly appreciated. Thanks

sammyraul avatar Mar 18 '19 22:03 sammyraul

set command is not what you want. Please try push or addToSet

comtihon avatar Mar 19 '19 08:03 comtihon