question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Running `check` for one field

See original GitHub issue

I have some Meteor methods that update one field in a document, and for now I’m doing something like this:

if (email) {
  schemaContext.validateOne({email: email}, 'email') || throw new Meteor.Error(500, 'Invalid email');
  // Update email
}

I wanted to just use check lib for validation, but it doesn’t work because it requires all fields in the schema to exist (no validateOne variant of that).

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
aldeedcommented, Sep 12, 2016

In SimpleSchema 2.0, this can be done with

mySchema.validate({ email: email }, { keys: ['email'] });
0reactions
smohantyCMEcommented, Jan 21, 2021

In SimpleSchema 2.0, this can be done with

mySchema.validate({ email: email }, { keys: ['email'] });

What about cleaning just 1 field? Can that be done too?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run validation for one field in Mongoose model - Stack Overflow
This way, the bar validator will run before your pre-validate hook. Also, I don't see why the validation of one field would rely...
Read more >
Examples of query criteria - Microsoft Support
Query criteria help you zero in on specific items in an Access database. If an item matches all the criteria you enter, it...
Read more >
how to check that the value of one field is presen...
Hi,. I have 2 events which are not containing same fields. ... I want to check if the id "efgh" is a value...
Read more >
How to run an online idxfix to check one indexed field?
An "Index Fix Utility" menu will be presented: Select: OPTION 3 "Both 1 (Scan records for missing index entries.) and 2 (Scan indexes...
Read more >
Run Spell Check In Access On One Field In A Form
Run Spell Check In Access On One Field In A Form ... If you want to automatically run the spell checker in an...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found