收藏
回答

为什么同样的表达式,云函数只能获取一大组数据,而不用云函数就能获取指定的数据?

为什么同样的表达式,云函数只能获取一大组数据,而不用云函数就能获取指定的数据?


例如:在云函数中:

const db=cloud.database()

const _ = db.command

// 云函数入口函数

exports.main = async (event, context) => {

 return await db.collection('xiangmu').where({

 openid:event.openid,

          bhao:event.bha


 }).get()

在普通前端JS中代码

db.collection('xiangmu').where({

          openid:options.openid,

          bhao:options.bhao

     }).get().then(res=>{

          console.log(res)

         })

前端能够获取数据库里面相同条件的一个数据,而云函数,则是获取了同个openid下的所有数据,而bhao没有起到作用,请问是怎么回事,


希望高手解答,谢谢


回答关注问题邀请回答
收藏

1 个回答

  • Ray
    Ray
    2022-07-14

    const db=cloud.database()

    const _ = db.command

    // 云函数入口函数

    exports.main = async (event, context) => {

     return await db.collection('xiangmu').where({

     openid:event.openid,

              bhao:event.bhao //少了一个o


     }).get()


    2022-07-14
    有用 1
    回复 2
    • 笑看人生
      笑看人生
      2022-07-18
      谢谢
      2022-07-18
      回复
    • Ray
      Ray
      2022-07-19回复笑看人生
      帮忙点个有用  谢谢
      2022-07-19
      回复
登录 后发表内容