Last active
November 20, 2020 16:30
-
-
Save alyssoncm/e355813d3c57efc9d2dc4f79a003a1a5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Parse.Cloud.define("DogsWithRegex", async (request) => { | |
// Returns all Dogs that are owned by a given name. The name must be at least 3 characters long to be valid. | |
const query = new Parse.Query("Dog"); | |
query.equalTo("owner", request.params.owner); // We use the owner parameter to match | |
const results = await query.find(); | |
return results; | |
},{ | |
fields : { | |
owner : { | |
required: true, | |
type: String, | |
options: val => { | |
return val.length >= 3; // will return TRUE if the length of the string is >= 3 | |
}, | |
error: "The Owner's name must have at least 3 characters" | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment