mongodb - Meteor does not display collection that exists in db -


a meteor/react noob here, going through meteor-react tutorial , got stuck on step 3. problem data not being displayed in browser, although exists in db.

here imports/ui/app.jsx:

import react, { component, proptypes } 'react'; import { createcontainer } 'meteor/react-meteor-data';  import { tasks } '../api/tasks.js';  import task './task.jsx';  class app extends component {   rendertasks() {     return this.props.tasks.map((task) => (       <task key={task._id} task={task} />     ));   }    render() {     return (       <div classname="container">         <header>           <h1>todo list</h1>         </header>          <ul>           {this.rendertasks()}         </ul>       </div>     );   } }  app.proptypes = {   tasks: proptypes.array.isrequired, };  export default createcontainer(() => {   return {     tasks: tasks.find({}).fetch(),   }; }, app); 

no errors show in console.

basically this.props.tasks returns empty array. db.tasks.find({}) in console shows records. without changing around, if hardcode tasks records, display alright, issue isn't task component. can here? appreciate.

client/main.jsx:

import react 'react'; import { meteor } 'meteor/meteor'; import { render } 'react-dom';  import app '../imports/ui/app.jsx';  meteor.startup(() => {   render(<app />, document.getelementbyid('render-target')); }); 

package.json:

{   "name": "simple-todos",   "private": true,   "scripts": {     "start": "meteor run"   },   "dependencies": {     "meteor-node-stubs": "~0.2.0",     "react": "^15.1.0",     "react-addons-pure-render-mixin": "^15.1.0",     "react-dom": "^15.1.0"   } } 

npm version 3.3.12 node version 5.6.0

as of description from, seems database not accessible on both server & client. may forgot add reference of database in server side. try import tasks main.js file of server.

make sure server/main.js has following line:

import '../imports/api/tasks.js'; 

Comments

Popular posts from this blog

scala - 'wrong top statement declaration' when using slick in IntelliJ -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

PySide and Qt Properties: Connecting signals from Python to QML -