To simplify the question, I have labeled error scenario as Scenario A, working scenario as Scenario B, I would like to know why it does what it does
Scenario A (error)
Scenario B (working)
I would like to understand why Scenario A does not add the string of array/users to the database? Thanks in advance!
CodePudding user response:
This has to do with the JSON structure. When you simply enter a variable into the JSON without a field name, the variable name defaults to the field name.
For example, given var x = 5, {x} would auto expand to {x: 5} while {y: x} would expand to {y: 5}.
The same logic can be applied to your Cycle object, you're initiating it, in Scenario 1, with {usersA: usersA} instead of {users: usersA}




