MongoDB Stitch 3rd Party Services如何返回JSON数组对象?我的回报显示带有$(美元符号(的EJSON。有人可以帮助我吗?
return mycollection.findOne({"_id": BSON.ObjectId(id)});
响应例如:成本:{$numberDouble:"65"}
我需要例如:费用:65
参见: https://docs.mongodb.com/realm/mongodb/actions/collection.find/
要创建数组,请尝试:
return mycollection.find({"_id": BSON.ObjectId(id)}).toArray();
要解决数字双重问题,请参阅: MongoDB Stitch以$NumberDouble而不是数字本身的形式返回数据