findOne dose not work as expected


How can i retrieve only one entry? ,I have this this

import React, { Component } from 'react';
import { createContainer } from 'meteor/react-meteor-data';

//api entries
import { muscleGroups } from '../../api/muscleGroups.js';

export default class editMuscleGroup extends Component {
        return (
    render (){
        return <div>--{this.getMuslceGroup()}--</div>;
editMuscleGroup.propTypes = {
    muscleGroups: React.PropTypes.object

export default createContainer((params) => {
    return {
}, editMuscleGroup);
import { Mongo } from 'meteor/mongo';
export const muscleGroups = new Mongo.Collection('muscleGroups');

but is not working for me , I get undefined on this.props.muscleGroup.type

I use latest version of Meteor , with react
params.params.type is from the Link component

What I want is to use an link to transfer the user to an editing page of a single muscleGroup
When I click from the list of muscleGroups I get the expected result but if I refresh I get the TypeError: Cannot read property ‘type’ of undefined"
what I am missing ?
tanks in advance


Are you sure params.params.type is not undefined?


No “params.params.type” is defined , its served by <Link to="/muscleGrups/edit/chest" /> reactive component.
params.params.type is “chest” , as expected

the error is not in


is on this line



How are you subscribing to your data - are you using autopublish?


yes , I do use autopublish (I am learning the meteor platform, so I do not use the publishing and subscription methods)


So I figured out , the idea is that the data that we get with findOne is not available at the moment of the page refresh , so I instantiate the muscleGroup with an empty object that is automatically updated when the data is ready

export default createContainer((params) => {
    return {
}, editMuscleGroup);

they rely need to specify things like this up front .
because I think this may be a common problem
tanks hwillson and jhuenges for the interest