如何从集合中提取对象?

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (40)

当我写下列代码时:

db.collection("girlTypes").find()

错误报告如下:

TypeError: Converting circular structure to JSON
at JSON.stringify (<anonymous>)
at stringify (C:\rater\rater\server\node_modules\express\lib\response.js:1119:12)
at ServerResponse.json (C:\rater\rater\server\node_modules\express\lib\response.js:260:14)
at ServerResponse.send (C:\rater\rater\server\node_modules\express\lib\response.js:158:21)
at app.get (C:\rater\rater\server\src\app.js:265:17)
at Layer.handle [as handle_request] (C:\rater\rater\server\node_modules\express\lib\router\layer.js:95:5)
at next (C:\rater\rater\server\node_modules\express\lib\router\route.js:137:13)
at complete (C:\rater\rater\server\node_modules\passport\lib\middleware\authenticate.js:263:13)
at C:\rater\rater\server\node_modules\passport\lib\middleware\authenticate.js:270:15
at pass (C:\rater\rater\server\node_modules\passport\lib\authenticator.js:431:14)
at Authenticator.transformAuthInfo (C:\rater\rater\server\node_modules\passport\lib\authenticator.js:453:5)
at C:\rater\rater\server\node_modules\passport\lib\middleware\authenticate.js:267:22
at C:\rater\rater\server\node_modules\passport\lib\http\request.js:52:7
at C:\rater\rater\server\node_modules\passport\lib\sessionmanager.js:26:5
at pass (C:\rater\rater\server\node_modules\passport\lib\authenticator.js:277:43)
at serialized (C:\rater\rater\server\node_modules\passport\lib\authenticator.js:286:7)

所有作者都说这个命令应该返回我所遗漏的对象列表,所以应该如何从集合中提取对象呢?

提问于
用户回答回答于

db.collection("girlTypes").find({}).toArray(function(error, girlType)

所属标签

可能回答问题的人

  • 找虫虫

    0 粉丝0 提问6 回答
  • 爸爸

    腾讯 · 客户端安全 (已认证)

    4 粉丝4 提问5 回答
  • uncle_light

    5 粉丝518 提问5 回答
  • 优惠活动秘书

    0 粉丝2 提问4 回答

扫码关注云+社区

领取腾讯云代金券