当前位置: 首页 > 工具软件 > Parse Server > 使用案例 >

Parse Server更新数据库代码demo

巩子实
2023-12-01
const Parse = require('../test/lib/parseInit').Parse;

const update = async () => {
  try {
    const obs = new Parse.Object('Obs');
    obs.set('objectId', 'yiFMMatsgF');
    const query = new Parse.Query('Project');
    const list = await query.find();
    for (let i = 0; i < list.length; i += 1) {
      const project = list[i];
      project.set('obs', obs);
      await project.save();
    }
    return Promise.resolve(); 
  } catch (e) {
    return Promise.reject(e);
  }
}

update().then(() => {
  console.log('success');
}).catch((e) => {
  console.log('e------' ,e);
})

 类似资料: