How to access external mongodb from meteor?

how to run meteor server when ionic serve or build ?

I’m not sure what you’re asking about with ionic serve/build but if you want to have meteor running on one instance and mongoDB on a different instance you run the following exports (this scenario applies when you’re doing meteor build for a production build.

export MONGO_URL=mongodb://IP:PORT/DB?replicaSet=rs0
export MONGO_OPLOG_URL=mongodb://IP:PORT/local?replicaSet=rs0
node main.js