【问题标题】:MongoDB Stitch Return JSON Array ObjectMongoDB Stitch 返回 JSON 数组对象
【发布时间】:2020-06-02 22:23:14
【问题描述】:

MongoDB Stitch 3rd Party Services 如何返回 JSON 数组对象?我的回报是显示带有 $(美元符号)的 EJSON。有人可以帮助我吗?

return mycollection.findOne({"_id": BSON.ObjectId(id)});

响应例如:成本:{$numberDouble: "65"}

我需要例如:成本:65

【问题讨论】:

    标签: mongodb stitch


    【解决方案1】:

    见: https://docs.mongodb.com/realm/mongodb/actions/collection.find/

    创建一个数组试试:

    return mycollection.find({"_id": BSON.ObjectId(id)}).toArray();
    

    要解决 numberDouble 的问题,请参阅: MongoDB Stitch returns data as $NumberDouble instead of the number itself

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-12-14
      • 1970-01-01
      • 1970-01-01
      • 2021-06-09
      • 1970-01-01
      • 2019-12-09
      • 2018-12-11
      • 1970-01-01
      相关资源
      最近更新 更多