Skip to content

Object [object Object] has no method '$set' #8

@ndarilek

Description

@ndarilek

Using your package throughout my app, but I'm hitting a place where the result of a findOne lacks $set.

The code doesn't look particularly interesting, literally just a findOne, a bit of error-checking and an attempt to perform $set on the findOne result. Here it is for completeness' sake (It's in LiveScript):

if from? and to? and Roles.userIsInRole(from, "assistant") and Roles.userIsInRole(to, "client")
  attempt = Attempts.findOne({callId: call._id})
  if attempt?
    task = Tasks.find(attempt.taskId)
    if task?
      console.log("Attempt", attempt)
      attempt.$set({status: "pending"}) // fail

This is the only place I use a $method on a member of the Attempts collection, it works fine on others. The README says that if collections attach their own transforms then they don't get these methods. Is there any way I can check for this? I don't see that I'm doing this anywhere else in my code.

Also, I ran a test in meteor shell and $set appears to be defined on the result of my findOne. Thoughts on what else to try?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions