小编use*_*710的帖子

如何查看弹性beanstalk实例的公共IP地址以将mongodb图集列入白名单

我正在尝试从运行在弹性 beantalk 上的服务连接到托管在 mongo atlas 上的数据库。我收到错误:

UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [youmaylike-shard-00-01-necsu.mongodb.net:27017] on first connect [MongoNetworkError: connection 5 to youmaylike-shard-00-01-necsu.mongodb.net:27017 closed]

我相信这种情况正在发生,因为我的服务的 IP 地址没有在地图集上列入白名单。我不确定如何获取我的服务的 IP 地址,我尝试运行eb ssh但我不确定它给我的是正确的值

amazon-web-services amazon-elastic-beanstalk mongodb-atlas

6
推荐指数
1
解决办法
5588
查看次数

Mongoosejs .find 返回整个模型而不是文档

我在现有模型上运行 .find() 查询。我过去曾使用过此代码并且什么也没改变,但现在突然由于某种原因它不起作用。我在想 MongoDB 或 MongooseJS 已更新并且功能已更改。

var retrieve = function() {
  Repo.find({}, function(err, docs) {
    console.log(docs)
  })
};

retrieve();
Run Code Online (Sandbox Code Playgroud)

返回

[
  model {
    '$__': InternalCache {
      strictMode: true,
      selected: {},
      shardval: undefined,
      saveError: undefined,
      validationError: undefined,
      adhocPaths: undefined,
      removing: undefined,
      inserting: undefined,
      version: undefined,
      getters: {},
      _id: 5e02e91c908f0f086e737189,
      populate: undefined,
      populated: undefined,
      wasPopulated: false,
      scope: undefined,
      activePaths: [StateMachine],
      pathsToScopes: {},
      ownerDocument: undefined,
      fullPath: undefined,
      emitter: [EventEmitter],
      '$options': true
    },
    isNew: false,
    errors: undefined,
    _doc: {
      __v: 0,
      stars: 2, …
Run Code Online (Sandbox Code Playgroud)

javascript database mongoose mongodb node.js

3
推荐指数
2
解决办法
4012
查看次数