Meteor without MongoDB


#1

(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?


#2

I think your error comes from autoupdate


#3

@slava - I didn’t install autoupdate back…


#4

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 without-mongodb.meteor.com?


#5

Is appcache in your project? You can check if any of your other packages are using it https://atmospherejs.com/meteor/appcache under “dependants”.


#6

@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.


#7

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

To answer your question - yes I believe so.


#8

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


#9

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??


#10

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


#11

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 Meteor.call 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.


#12

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



#13

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.


#14

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
aswell.

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…


#15

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


#16

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

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


#17

It seems it’s not possible yet to subscribe to a localcollection from the server, https://github.com/meteor/meteor/blob/350bf75112dc7e5a6d0349df17898670268216c7/packages/minimongo/minimongo.js#L241
there’s a dependency in publishing/subscribing to Mongo.cursor, which is planned to be fixed, only MDG, probably, knows when…


#18

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.