'How to get all columns from a Parse platform class
I am trying to get all columns from a class in a Parse platform using cloud code that returns a list/array of all the names of the columns.
I am looking at the schema section of the documentation, but I can't find how to get the column's names, only adding, deleting, ...
However, I found this method, but I haven't figured out how to use it neither found any example.
This is what I have right now (doesn't work, neither is the only thing I tried, but hopefully it can help you understand my situation):
Parse.Cloud.define("getAllProperties", async (request) => {
var mySchema;
try {
mySchema = new Parse.Schema('Entry');
} catch (error) {
console.error("ERROR " + error.code + ': ' + error.message);
return error;
}
console.log("CloudFunction 'getAllProperties' executed successfully.");
return mySchema.toString();
});
Solution 1:[1]
I found a way to do it:
Parse.Cloud.define("getAllProperties", async (request) => {
var mySchema;
try {
mySchema = new Parse.Schema('Entry');
mySchema = await mySchema.get()
} catch (error) {
console.error("ERROR " + error.code + ': ' + error.message);
return error;
}
console.log("CloudFunction 'getAllProperties' executed successfully.");
return JSON.stringify(mySchema);
});
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Guillem Poy |
