Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Useful stuff

lu40 edited this page Feb 5, 2018 · 1 revision

Working with mongo-db

  • reset db: $ meteor reset && meteor npm run dev
  • you might use some mongo-db-UI. We use robomongo regularly.
  • Ctrl-M shows the Minimongo of the client (we use package mongol)
Mongo shell

To enter the mongo shell run meteor mongo inside the app dir. From there you can easily run queries on the db (e.g.db.users.find({username:'greg'}).pretty()).

For the full docs go to https://docs.mongodb.com/.

Finding bugs

  • Chromium often works better than Firefox
Patch to show actual template exceptions
diff --git packages/spacebars/spacebars-runtime.js packages/spacebars/spacebars-runtime.js
index c79b1fc..413e29d 100644
--- packages/spacebars/spacebars-runtime.js
+++ packages/spacebars/spacebars-runtime.js
@@ -131,8 +131,12 @@ Spacebars.call = function (value/*, args*/) {
       var arg = arguments[i];
       newArgs[i-1] = (typeof arg === 'function' ? arg() : arg);
     }
-
-    return value.apply(null, newArgs);
+       try {
+               return value.apply(null, newArgs);
+       } catch (shit) {
+               console.log(shit)
+       }
+       return null
   } else {
     if (arguments.length > 1)
       throw new Error("Can't call non-function: " + value);

Use a local copy of a package in dev

Sometimes you want to tinker with a meteor package. Clone the package to a separate folder:

git clone https://github.com/gadicc/meteor-messageformat.git ~/src/meteor-messageformat

then symlink the desired packages from the packages dir:

ln -s ~/src/meteor-messageformat/packages/ui ~/src/hmmm/packages/msgfmt:ui

If you want to return to the stock version of the package, just remove the link again:

rm ~/src/hmmm/packages/msgfmt:ui

Inspecting a mobile device

In order to read the console logs/errors produced by a browser on a mobile device the setup describe here can be of great use. It uses the node.js package weinre and is setup very easily.

The mentioned script can be added for debugging purposes to head.html so it looks like this:

<head>
  <!-- <meta>, <noscript> etc... -->
  <script src="http://YOUR.IP.ADDRESS.HERE:8080/target/target-script-min.js#anonymous"></script>
</head>