Sending data from a Method to React Container



I’m getting a list of objectIds from elasticsearch and I wish to send them to the client in an ordered manner. If I simply publish them via a publication, I won’t be able to send the ordered list as well as far as I know. Therefore my plan is to retrieve the data via a method. I’m able to pull the data correctly (in order) from the method, but i’m having difficulties sending the data from the method to the React component.

this is my AppContainer

import React, { Component, PropTypes } from 'react'
import { createContainer } from 'meteor/react-meteor-data'
import AppPage from './AppPage.js'
import { Posts } from '../../api/posts/posts.js'
import { ReactiveVar } from 'meteor/reactive-var'
import { Feed } from '/imports/api/feed/feed.js'

export default AppContainer = createContainer(({ params }) => {

  const { tag } = params
  let postsHandle
  let posts = new ReactiveVar([])
  if (tag) {'getFeed', { tag: tag }, (err, res) => {
      Feed.upsert({_id: 'posts'}, {res})
  } else {
    postsHandle = Meteor.subscribe('posts');
    posts = Posts.find().fetch()

  return {
    posts: Feed.find({_id: 'posts'}).fetch(),
    user: Meteor.user(),
}, AppPage);

my Feed minimongo object is a client only collection, created as indicated from the guide:

export const Feed = new Mongo.Collection(null)

The result that I get from the Meteor call is the correct data. The upsert call seems to be successful (it says that one record is affected). But I can’t seem to get the data to go through to the actual React component.