Validation object must have at least one operator / meteor mongo

后端 未结 2 1958
慢半拍i
慢半拍i 2021-01-19 03:11

I wrote a method to a user\'s address to a collection. However, i keep getting the error:

When the modifier option is true, validation object must have at le         


        
相关标签:
2条回答
  • 2021-01-19 03:54

    Yeah, that error kinda sends you in the wrong direction. Regardless, you're using $addToSet on an object. Do this:

    Meteor.users.update(currentUserId, {$set: addressDetails.address}
    
    0 讨论(0)
  • 2021-01-19 04:05

    Try the following code:

    Meteor.users.update(
      {$currUserId}, 
      {$addToSet:
        {'address.streetAddress': addressDetails.streetAddress,
         'address.city': addressDetails.city,
         'address.state': addressDetails.state,
         'address.zipCode': addressDetails.zipCode
        }
    });
    
    0 讨论(0)
提交回复
热议问题