12345678910111213141516171819202122232425262728293031323334353637383940 |
- const { ParseObject } = require("./fmode-parse");
- async function main(){
- // testFind()
- // testSave()
- testUpdate()
- }
- async function testUpdate(){
- // 根据ID获取
- let lostfound = new ParseObject("Items");
- lostfound = await lostfound.get("w03dUQKOJG")
- console.log(lostfound)
- // 根据有ID的对象,保存新属性
- lostfound.set({
- name:"学生证"
- })
- lostfound.save()
- }
- async function testFind(){
- // 查询测试
- let Items = new ParseObject("Items")
- let list = await Items.findAll()
- console.log(list)
-
- }
- async function testSave(){
- // 创建测试
- let lostfound = new ParseObject("Items")
- lostfound.set({
- category: '失物招领',
- title: '李小珊洗衣液',
- publisher: '小耶',
- })
- lostfound = await lostfound.save();
- console.log(lostfound) // id w03dUQKOJG
- console.log(lostfound.toJSON())
- }
- main()
|