Mongo in client-side only

I think it is possible already. Some repro code here:

  1. Create a minimal Meteor project
$ meteor create nomongo --minimal
$ cd nomongo && meteor npm install
  1. create a local package that includes mongo package client-only:
$ mkdir packages && cd packages
$ meteor create --package minimongoclient
$ meteor add minimongoclient

Then in package.js:

Package.describe({
  name: 'minimongoclient',
  version: '0.0.1',
  // Brief, one-line summary of the package.
  summary: '',
  // URL to the Git repository containing the source code for this package.
  git: '',
  // By default, Meteor will default to using README.md for documentation.
  // To avoid submitting documentation, set this field to null.
  documentation: 'README.md'
})

Package.onUse(function (api) {
  api.versionsFrom('1.10.2')
  api.use('ecmascript')
  api.imply('mongo', 'client')
})
  1. Start app and look for the Mongo definition

Add the following code to server/main.js and client/main.js:

Meteor.startup(() => {
  console.log(global.Mongo)
})

It will login on server:

undefined

and on client:

{
  Collection: function Collection(name, options)​,
  Cursor: class Cursor { constructor(collection, selector) }​,
  ObjectID: class ObjectID { constructor(hexString) }
}

You can also lookup the folder .meteor/local/build/programs/server/ contains no mongo.js file, while .meteor/local/build/programs/web.browser/does.

I am not sure if this will work on deployment but it seems to work as any project created using --minimal does not contain mongo by default.