Interactions with mongo collections fails on Cordova


Hello guys, I’m trying to build an mobile app to read a qrcode and subtract a value in a collection.
To read the qrcode I’m using Cordova’s BarcodeScanner plugin, so.

How I’m building the app:

meteor build ../redpass-builds --server=  --mobile-settings=settings.json

How I reach the page:

    subscriptions: function(params, queryParams) {
        this.register('events', Meteor.subscribe('AllEventsIsTodayMoreOneDay'));
        this.register('transactions', Meteor.subscribe('AllTransactions'));
        this.register('lotes', Meteor.subscribe('AllLotes'));
    action: function(params) {
        FlowLayout.render('Private', {main: "TicketValidation"});

How my template looks like:

<template name="TicketValidation">
    <div style="text-align: center">
        {{#if isReady "events"}}
            {{#if isReady "transactions"}}
                {{#if isReady "lotes"}}
                    <button type="button" class="scan btn btn-primary btn-lg"><i class="fa fa-qrcode fa-5x"></i></button>

How I read the qrcode:{
    'click .scan':function(){
            function (result) {
                var transactionId = result.text;

                var transactions = Transactions.find({}).fetch().count();

                var transaction = Transactions.findOne({_id:transactionId});

                var quantity = parseInt(transaction.quantity);
                    var remainder = quantity-1;
                    alert("Ingresso válido!")
                    alert("Esse ingresso já foi utilizado!")
            function (error) {
                alert("Não foi possível verificar o ingresso!");

Ok! Qrcode reading works fine! The alert with transactionId is fired nicely but, for some reason the next line that interacts with Transactions collection doesn’t, I don’t know why. Anyone has some idea?



I found the problem, but not the solution.

The problem is that for some reason, when app is rendered Meteor.status().status is connected but after few seconds the status down to waiting and goes to connecting and still connecting forever…