MongoError when i upade

I try to update mongo collection(usr), but i have some error
MongoError: '$set' is empty. You must specify a field like so: {$mod: {<field>: ...}}
There is .js
‘submit .profileEdit’: function(e) {

var currentProfid = this._id;

var profProperties = {
  uname: $(e.usr).find('[name=uname]').val(),
  usurname: $(e.usr).find('[name=usurname]').val(),
  uabout: $(e.usr).find('[name=uabout]').val()

usr.update(currentProfid, {$set: profProperties}, function(error) {
  if (error) {
    // display the error to the user
  } else {
    Router.go('profile', {_id: currentProfid});

});And .html

      <input id="icon_prefix" type="text" class="uname">
      <label for="icon_prefix">{{uname}}</label>

  <div class="row">
    <div class="input-field col s6">
      <input id="icon_prefix" type="text" class="usurname">
      <label for="icon_prefix">{{usurname}}</label>

  <div class="row">
    <div class="input-field col s6">
      <input id="icon_prefix" type="text" class="uabout">
      <label for="icon_prefix">{{uabout}}</label>
  <button class="btn waves-effect waves-light" type="submit">Submit</button>


Help, please.

It looks like your profProperties object isn’t being set properly, which means you’re not referencing your submitted values properly. I would try setting it like:

var profProperties = {

and modifying your form input elements to have explicit name attributes like:

<input id="icon_prefix" type="text" class="uname" name="uname" />
<input id="icon_prefix" type="text" class="usurname" name="usurname" />
<input id="icon_prefix" type="text" class="uabout" name="uabout" />
1 Like

thank you! It work!!