const cloud = require('@alipay/faas-server-sdk');

exports.main = async (event, context) => {
  try {
    const { username , password } = event;

    // 获取 cloud 环境中的 mongoDB 数据库对象

    const db = cloud.database();

   

    // 使用 where 条件查询集合对象test

    const data = await db.collection('mysql1')

      .where({
        username: username,
        password: password

      })

      // 使用 get 获取文档数据

      .get();

    return { success: true, msg: '查询成功', data };

  } catch (err) {
    return { success: false, msg: `查询失败 - ${err.toString()}` };

  }

};