mongodb - Meteor: record in db updating, but data not changing on screen -


here's simplified version of have in 1 of templates:

{{#each datarecord}}  {{#if editingnow}}    <tr class="datarow">     <td><button class="updaterecord" id="{{this._id}}">sav</button></td>     <td><input type="text" id="{{this._id}}" value="{{this.f}}"></td></td>   </tr>    {{else}}    <tr class="datarow">     <td><button class="edit" id="{{this._id}}">edit</button></td>     <td>{{this.f}}</td>      <td><button class="deleterecord" id="{{this._id}}">del</button> </td>   </tr>  {{/if}}  {{/each}} 

editingnow returns value of boolean session variable starts out false. when page loads, user sees value of 'f' field each record , edit button. edit button flips session variable true , data shown using input element. user can edit data , click button, save button. button updates record using _id , flips session variable false.

the works far editing data goes -- record getting updated. can check value in console , see has been changed. data gets displayed in table reverts original value. can see change displayed in field briefly , flips back. weirder, if click edit button again, table still displays old value. way see updated data in field restart app.

this problem never occurred when using local mongo db or when linking database on meteor.com. has started happening since moved app modulus.io. ideas?

update although not figure out causing reactive update problem in template, ethaan's help, able better understanding of issue , find work-around, i've accepted answer , bottom of eventually.

seems have allow/deny problems maybe?

try with

collection.allow({  insert:function(){return true;},  remove:function(){return true;},  update:function(){return true;}, }) 

or check connection database succefull, go admin panel on modulus

option 2

clean database , make dummy insert on server side.

first on meteor shell run meteor reset.

or if have application on modulus.io use mongo shell, , use piece of code.

db.getcollectionnames().foreach(function(name) {   if (name.indexof('system.') === -1) {     db.getcollection(name).drop();   } }) 

now when sure database empty, put on server side.

//server code.     meteor.startup(function(){       if(collection.find().count() == 0){         collection.insert({serverinsert:"test server"},function(err,result){          if(!err){           console.log("insert succefull")         }      })     }   }) 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -