I am attempting to locate the value of the num
property within this object by using the name
property to identify the correct object from the hashtagsl
array; thus, obtaining the correct num
value. I need to accomplish this task with only the information of the name within the element and the user ID. The ultimate objective is to assign a variable to the value of the num
in the specific object. Below is the code that generates the object to display its structure. Thank you in advance.
All code displayed is executed on the server side.
Meteor.users.update({"_id": this.userId},{"$push":{"profile.hashtagsl": {name: newhashtag, num: 1}}})
edit
The following code snippet updates the num
property by incrementing it. My goal is to retrieve the value of num
without updating it.
Meteor.users.update({"_id": this.userId, "profile.hashtagsl.name":hashi},{"$inc":{"profile.hashtagsl.$.num":1}});