从Parse Server连接到本地mongodb

时间:2016-04-23 14:00:24

标签: ios mongodb localhost parse-server

我正在尝试将iOS应用程序连接到Parse Server的本地实例。

我使用mongorestore恢复了我的mongo数据库的转储,我可以在localhost:27017上的MongoChef上连接它。

但是,通过Parse Server连接它似乎不起作用。 这是我的index.js文件的一部分:

var api = new ParseServer({
  databaseURI: 'mongodb://localhost:27017/my-database-name',
  cloud: process.env.CLOUD_CODE_MAIN || __dirname + '/cloud/main.js',
  appId: process.env.APP_ID || 'myAppId',
  masterKey: process.env.MASTER_KEY || '',
  serverURL: process.env.SERVER_URL || 'http://localhost:1337/parse',
  fileKey: process.env.FILE_KEY,
  liveQuery: {
    classNames: ["Posts", "Comments"]
  }
});

我是否正确设置了databaseURI?我认为这就是我的问题所在。

我的本​​地解析服务器正在http://localhost:1337/parse上运行,我的应用正在使用以下代码连接到它:

let configuration = ParseClientConfiguration {
            $0.applicationId = self.applicationId
            $0.clientKey = self.clientKey
            $0.server = self.serverURL
            $0.localDatastoreEnabled = true
        }
Parse.initializeWithConfiguration(configuration)

其中serverURL返回http://localhost:1337/parse

但是当我使用此配置运行我的应用程序时,我的查询不返回任何数据。

0 个答案:

没有答案