React collection.observe not firing


Hi all,

I am using meteor 1.3 with react.
I have a collection called Model_Members where each doc has an object “viewsettings”.
I would like to run the function refreshLines() when the viewsettings.mapBounds field changes. The function refreshLines() calls a Meteor method which returns an array of lines within the map bounding box. These lines are put into a local collection on the client.

I am having trouble, because refreshLines() is not triggered when I change the mapBounds field in the server console: Like so:

Any advice would be greatly appreciated

import { Meteor } from ‘meteor/meteor’;
import { createContainer } from ‘meteor/react-meteor-data’;

import { Model_Members } from ‘…/…/api/collections/model_members.js’;
import { MapPage } from ‘…/pages/mappage.jsx’;

Lines = new Mongo.Collection(null);

function refreshLines(modelId) {
Lines.remove({})‘lines.updatex’,modelId,(err, res) => {
if(res) {
res.forEach((item) => {
} else {

export default createContainer(props => {
const { modelId } = props.params

Meteor.subscribe(‘model_members.viewsettings’, modelId, function() {
const viewsettings = Model_Members.find({},{fields:{‘viewsettings.mapBounds’:1}});
changed: refreshLines(‘X3W’)
return {
lines: Lines.find().fetch()
}, MapPage);



Looks like I used the outdated API.
The new API:
changed(newDocument, oldDocument)


You assigned the return value of refreshLines to the changed key in the first argument to observe(). That was supposed to be a function, not the value returned from it. :slight_smile: