fmode-parse-test.js 964 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. const { ParseObject } = require("./fmode-parse");
  2. async function main(){
  3. // testFind()
  4. // testSave()
  5. testUpdate()
  6. }
  7. async function testUpdate(){
  8. // 根据ID获取
  9. let lostfound = new ParseObject("Items");
  10. lostfound = await lostfound.get("w03dUQKOJG")
  11. console.log(lostfound)
  12. // 根据有ID的对象,保存新属性
  13. lostfound.set({
  14. name:"学生证"
  15. })
  16. lostfound.save()
  17. }
  18. async function testFind(){
  19. // 查询测试
  20. let Items = new ParseObject("Items")
  21. let list = await Items.findAll()
  22. console.log(list)
  23. }
  24. async function testSave(){
  25. // 创建测试
  26. let lostfound = new ParseObject("Items")
  27. lostfound.set({
  28. category: '失物招领',
  29. title: '李小珊洗衣液',
  30. publisher: '小耶',
  31. })
  32. lostfound = await lostfound.save();
  33. console.log(lostfound) // id w03dUQKOJG
  34. console.log(lostfound.toJSON())
  35. }
  36. main()