Meteor without MongoDB

(First, wow, I didn’t know your PC can crash and Discourse [the forums system] will save your post. That’s really thoughtful)

I don’t need a DB for my app.
I want to remove MongoDB from meteor.
Meteor without mongodb.
Why is it so hard to have Meteor do what I want and not the only thing Meteor was originally designed to do?

What do I do to remove Mongo?

I tried:

  1. Tried: Via Meteor without mongo on stackoverflow
    I first removed everything by meteor remove meteor-platform, then I added everything except mongo meteor add minimongo meteor webapp logging tracker session ddp blaze spacebars templating check underscore jquery templating check underscore jquery random. I also commented out all Mongo code.
    Got: On startup:

    => Meteor server restarted
    I20150608-17:27:50.687(3)? Exception from sub meteor_autoupdate_clientVersions id DPQXvDjisFYpj5B2A ReferenceError: Mongo is not defined
    I20150608-17:27:50.688(3)? at [object Object].LocalCollection.Cursor.publishCursor (packages/minimongo/minimongo.js:247:1)
    I20150608-17:27:50.688(3)? at [object Object].
    .extend.runHandler (packages/ddp/livedata_server.js:986:1)
    I20150608-17:27:50.689(3)? at [object Object].
    .extend.protocol_handlers.sub (packages/ddp/livedata_server.js:582:1)
    I20150608-17:27:50.688(3)? at [object Object]._.extend._startSubscription (packages/ddp/livedata_server.js:769:1)
    I20150608-17:27:50.689(3)? at packages/ddp/livedata_server.js:546:1

  2. Then, I thought, maybe packages that depend on mongo like that ddp over there in the log need mongo? so I meteor remove livequery ddp insecure autopublish minimongo

  3. Nope. Same error. Wait, Livequery’s meteor docs page referenced to an interesting package I might meteor add disable-oplog.

  4. Same same. Error doesn’t change.

What do?

I think your error comes from autoupdate

@slava - I didn’t install autoupdate back…

Meteor becomes what people desire it to be, which includes the originators of the whole Meteor idea as well as the whole community behind it.
There is no reason at all why Meteor shouldn’t be able to function well without MongoDB, and make it easy for users to be able to tell it to not expect a MongoDB instance to be there.

What needs to happen is a clear idea needs to be formed about what exactly “without MongoDB” means (and maybe that part exists already) and then “how to let Meteor know easily what you want” (that part seems to not be there yet, as you’re having to follow a bunch of steps from SO, so it’s not as straightforward as it could be), and then the “how do we implement this” part comes relatively naturally. It could always be that the priorities are still not at the point where the core team would divert enough attention to then implementing what’s been imagined and put forward as a complete suggestion, but then if there is enough interest from within the community it would still be very possible to implement that anyway. Community package? Curated, targeted No-MongoDB “distribution” of Meteor? Boilerplate/project template? Dedicated docs at

Is appcache in your project? You can check if any of your other packages are using it under “dependants”.

@TwinTails Very interesting package, not quite what I wanted. I simply wanted to operate without a database because I don’t need / want to install it on my target server.

Though, I wanted to ask, hot code pushes work better with appcache installed?

Edit: Oh you’re asking whether I have it - No, I haven’t installed it or have any of the dependants.

What happens if you search for the line “meteor_autoupdate_clientVersions” in your project?

To answer your question - yes I believe so.

We get two files identically named files from web.browser and server packages.

Update: Tried creating a brand new app without MongoDB - doesn’t work.

I just meteor create mongodb, and I get It looks like you are trying to access MongoDB over HTTP on the native driver port. in the browser when I access localhost:3000. Console.log’s sprinkled along the code don’t print anything.

So I guess you can’t run Meteor without MongoDB??

Your search indicates that you have the autoupdate package which depends on mongo in your project somewhere

OK, so I have succeeded in running a mongo-less app, I simply instructed meteor -p 3001 and apparently mongodb was at that port, I changed it and it worked.

And your right, after removing and re-adding one by one all of my packages, @TwinTails, on of them was dependant on meteor-platform.

Removed, removed removed, BUT, now there’s the next thing.
I’m trying to reach server->to->client reactivity - I don’t want to have everywhere in my client code.
I found the Meteor.publish API, along with the added, changed and removed low level API, which is one part of the reactivity, from the server side.
What I haven’t found, is how to use the data fetched by Meteor.subscribe without instantiating a new Mongo.Collection. Data is stored in Minimongo collections, Yes, but the docs say about this that the data is queued until a MongoDB Collection of the same name as the subscription is initialised - Which means ruling out throwing out MongoDB as dependency.

Is there some level API for subscribe (undocumented or something else) so I can have server to client reactivity? any other solution that works is welcomed just as well.

@wie: If you don’t want MongoDB and don’t use other database as well, meteor client only may suit your need:

If you initiate a new Mongo.Collection on the client only it will allow you to subscribe to your publication, but does not queue for MongoDB.

If i try to do that eithout having the mongo package it errors with mongo
isnt defined. If youll look closely in the docs, the Mongo.Collection
object is defined in the Mongo package, which means one cannot use client
side collections even with minimongo without having mongo installed

Thats really a shame since the collection api is merely a nice interface to
a Nosql typeof db, which is nice working with regardless of mongodb.

Guess you cant have minimongo without mongo, and you cant have server to
clieny reactivity without minimongo…

Isn’t it possible to use meteor add minimongo and access LocalCollection from the client side?

It is possible! why isn’t localcollection documented anywhere!?!

BTW @xamfoo, is it possible to access that collection from the server?

It seems it’s not possible yet to subscribe to a localcollection from the server,
there’s a dependency in publishing/subscribing to Mongo.cursor, which is planned to be fixed, only MDG, probably, knows when…

Just a note, if you never create a named collection on the server, the mongo package doesn’t try and connect. Try it by setting MONGO_URL="garbage" in development.

1 Like