External Mongo database?

I’m trying to create an external base and have Meteor connect with that - ultimately I want this to be on a shared network drive.

I tried creating the database with:

mkdir -p /data/db_meteor
sudo chmod 0755 /data/db_meteor
sudo chown $USER /data/db_meteor

Which all looks fine… But then when I tell meteor to connect to that database, I use:

MONGO_URL=mongodb://localhost:27017/data/db_meteor meteor

Then I get an error saying 'More than 1 database name in URL'

W20170619-08:34:17.540(1)? (STDERR) /Users/michaelbattcock/.meteor/packages/meteor-tool/.1.4.3_1.10pxpug++os.osx.x86_64+web.browser+web.cordova/mt-os.osx.x86_64/dev_bundle/server-lib/node_modules/fibers/future.js:280
W20170619-08:34:17.550(1)? (STDERR) 						throw(ex);
W20170619-08:34:17.551(1)? (STDERR) 						^
W20170619-08:34:17.552(1)? (STDERR) 
W20170619-08:34:17.552(1)? (STDERR) Error: More than 1 database name in URL
W20170619-08:34:17.552(1)? (STDERR)     at module.exports (/Users/michaelbattcock/.meteor/packages/npm-mongo/.2.2.16_1.w679h1++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/url_parser.js:126:13)
W20170619-08:34:17.553(1)? (STDERR)     at connect (/Users/michaelbattcock/.meteor/packages/npm-mongo/.2.2.16_1.w679h1++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongo_client.js:289:16)
W20170619-08:34:17.553(1)? (STDERR)     at Function.MongoClient.connect (/Users/michaelbattcock/.meteor/packages/npm-mongo/.2.2.16_1.w679h1++os+web.browser+web.cordova/npm/node_modules/mongodb/lib/mongo_client.js:113:3)
W20170619-08:34:17.553(1)? (STDERR)     at new MongoConnection (packages/mongo/mongo_driver.js:175:11)
W20170619-08:34:17.554(1)? (STDERR)     at new MongoInternals.RemoteCollectionDriver (packages/mongo/remote_collection_driver.js:4:16)
W20170619-08:34:17.554(1)? (STDERR)     at Object.<anonymous> (packages/mongo/remote_collection_driver.js:38:10)
W20170619-08:34:17.554(1)? (STDERR)     at Object.defaultRemoteCollectionDriver (packages/underscore.js:784:19)
W20170619-08:34:17.555(1)? (STDERR)     at new Mongo.Collection (packages/mongo/collection.js:99:40)
W20170619-08:34:17.555(1)? (STDERR)     at AccountsServer.AccountsCommon (packages/accounts-base/accounts_common.js:23:18)
W20170619-08:34:17.555(1)? (STDERR)     at new AccountsServer (packages/accounts-base/accounts_server.js:18:5)

I aso tried:

export MONGO_URL=mongodb://localhost:27017/data/db_meteor

But now I can’t even run meteor at all without getting the error, whats the opposite of ‘export’? I.e. how to I reset the mongo_url to the default…?

Anybody know a fix for this?

unset MONGO_URL

Thanks very much @robfallows, any idea about my initial problem?

Try this:

export MONGO_URL='mongodb://localhost:27017/data/db_meteor'

then run

meteor

Thanks @robfallows

Hi @odesey, unfortunately I get the same error with that:

Error: More than 1 database name in URL

My next question, once this is solved, is how do I create a meteor database on another machine and set that as the MONGO_URL…

You are trying to mix the db storage location with the database name. The URI specifies the database name only. The storage location is specified in the mongod configuration file or runstring --dbpath parameter (storage.dbPath and defaults to /data/db on OSX and Linux, \data\db on Windows).

Check the URI specification I linked to above.

Have you tried resetting the mongo_url?
Run this:

export MONGO_URL=

Then

meteor

Hello, I am making some tests with an external Mongo database, and just to make it easy to start the application I have configured a script in package.json like this:

  "scripts": {
    "start": "MONGO_URL=mongodb://user:passwd@host:port/db_name meteor --port 3000",
  }

Now to start the application just call:

npm start

That is working for me.

Regards.

Just like @robfallows says, I think your problem is the **/data/**db_meteor in the URL.

Try with:

export MONGO_URL=‘mongodb://localhost:27017/db_meteor’

Without the /data/ in the path.

Regards.