How to change the data type of a column...?

Hello There…!
I want to change the data type of a price column from string to number… so I can sort items list accordingly…
Somehow it is storing it as a string and I found other columns as well Like uid and tokenId are also string… whereas I am giving a number input…

So Is there a solution to change or something that I can use Like in beforesave???

I don’t know if it is a solution, I know that you can convert from string to number on query time, for example:

Moralis.Cloud.define("top_winners", async function(request){
  	const query = new Parse.Query("betss");
    query.equalTo("win", 1);
    const pipeline = [
      {
        group:{
          objectId: "$user",
          total_sum: { "$sum": { "$toInt" : "$bet"} }
        }
         
      },
      {sort: {"total_sum": -1}},
      {limit: 10}
      ]
    const result = await query.aggregate(pipeline, {useMasterKey: true});
    return result;
});
2 Likes

Hello @cryptokid,
How to make unique table column on moralis?

You can make a different post for this question. And I don’t know the answer without using before save to check for uniqueness

1 Like