【问题标题】:Why my mongodb-stitch service return me the value type ($numberLong, $numberInt,…)?为什么我的 mongodb-stitch 服务返回值类型($numberLong, $numberInt,...)?
【发布时间】:2018-11-26 19:31:38
【问题描述】:

为什么我的 mongodb-stitch 服务返回值的类型($numberLong, $numberInt,...)而 Compass 应用程序不这样做?

如何拥有与 Compas 中相同的变量格式,或者如何使用 Stitch 处理?

Mongodb-stitch

enter image description here

指南针

enter image description here

【问题讨论】:

  • 这就是 Stitch 向您显示数据的方式。您可以与这些值进行交互,就好像它们是正常的日期或数字一样。另外,如果你 console.log() 的值,你可以看到没有 $numberLong, $numberInt 的实际样子
  • 嗨,你找到解决办法了吗?

标签: mongodb-stitch


【解决方案1】:

MongoDB Stitch 函数可以访问通过各种全局变量提供的实用程序包。

其中一些如下:https://docs.mongodb.com/stitch/functions/utilities/
JSON
EJSON
BSON

当您执行您的函数时,将使用 EJSON 打印响应。 这就是为什么您会在结果选项卡中看到您的回复,在您回复的底部是这样的:

结果(JavaScript): EJSON.parse('[{"_id":{"$oid":"5bf9302f72a975ed8229fdf4"}, "rating": {"$numberDouble": "5"}, {...

【讨论】:

  • 我在使用猫鼬时发生这种情况,我该如何阻止它?
猜你喜欢
  • 2017-07-22
  • 2017-08-19
  • 1970-01-01
  • 2015-05-20
  • 1970-01-01
  • 2011-10-06
  • 2015-11-14
  • 2018-11-24
  • 1970-01-01
相关资源
最近更新 更多