0

I wanted to know how to go about getting a MongoHQ db to work on my localhost installation of Meter.

i tried using the settings.json method or the MONGO_URL=mongodb://user:pass@xxxx.mongohq.com:10061/xxxx when firing up meteor but both dont work and are probably the wrong way of doing it.

Moshe
  • 473
  • 1
  • 8
  • 22

1 Answers1

3

run it like this in your terminal within your project directory

MONGO_URL=mongodb://user:pass@xxxx.mongohq.com:10061/xxxx meteor

or

export MONGO_URL=mongodb://user:pass@xxxx.mongohq.com:10061/xxxx
meteor
Tarang
  • 75,157
  • 39
  • 215
  • 276
  • that did get it to use mongohq however its not make any collections. – Moshe Mar 24 '13 at 20:30
  • Meteor.startup(function () { var Customers = new Meteor.Collection("customers"); var Contacts = new Meteor.Collection("contacts"); console.log("Were Here"); if (Customers.find() === 0) { console.log("nothing found for customers"); Customers.insert({id: Customers.find().count() + 1, name: "Test Customer"}); }; console.log("Were now here"); if (Contacts.find({}) === 0) { console.log("nothing found for customers"); Contacts.insert({id: Contacts.find().count() + 1, first_name: "Test", last_name: "Contact"}); }; }); – Moshe Mar 24 '13 at 20:32
  • Was that server side or client side code? You have to wait for the subscriptions to complete before you can check whether the collections are filled up. Does it work on the normal local mongodb database btw? – Tarang Mar 24 '13 at 20:42
  • I believe it was working correctly, However I cant seem to be able to change the MONGO_URL back to meteor default so I can test it with meteor mongo from the console to be sure. – Moshe Mar 24 '13 at 21:47
  • did you use the export method? Use a new terminal – Tarang Mar 25 '13 at 05:21
  • There are also a couple of mistakes with your code `Customers.find()` will never `===0` & `var Customers` isn't global. With the corrections it would work as expected provided you wait for subscriptions on the client – Tarang Mar 25 '13 at 06:00
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/26881/discussion-between-moshe-and-akshat) – Moshe Mar 25 '13 at 16:28