I have a form on my site where users can enter a number in the field subNum. When a user submits a form, I want to check if a value already entered as a value exists in any existing document. This is all done in javascript / meteor
All form data is placed in the object as follows:
participantObject = {
subNum: parseInt(number)
}
This object is then inserted as a document into the collection. Participants
When the submit button is pressed, I need to check if the entered number has been entered (i.e. exists as the value for subNumin any document). If so, deny submitting the form and display an error message
I am trying to check something like this:
var existingSubs = Participants.find(
{subNum: {$eq: participantObject.subNum}}
).count();
console.log(existingSubs);
, , subNum (participantObject.subNum), , .
, Unrecognized operator: $eq
?
?