12345678910111213141516171819202122232425262728293031323334353637383940 |
- const { ParseObject } = require("./fmode-parse");
- async function main(){
- // testFind()
- // testSave()
- testUpdate()
- }
- async function testUpdate(){
- // 根据ID获取羊驼
- let yangtuo = new ParseObject("Pet");
- yangtuo = await yangtuo.get("XOeof1ppOS")
- console.log(yangtuo)
- // 根据有ID的对象,保存新属性
- yangtuo.set({
- price:300
- })
- yangtuo.save()
- }
- async function testFind(){
- // 查询测试
- let Pet = new ParseObject("Pet")
- let list = await Pet.findAll()
- console.log(list)
-
- }
- async function testSave(){
- // 创建测试
- let yangtuo = new ParseObject("Pet")
- yangtuo.set({
- name:"小羊驼",
- type:"羊驼",
- price:30000
- })
- yangtuo = await yangtuo.save();
- console.log(yangtuo) // id XOeof1ppOS
- console.log(yangtuo.toJSON())
- }
- main()
|