I am trying to retrieve a single value from a Meteor collection document to use in a three.js scene. I want to be able to create a three.js object that uses variables from the database. These variables are static for now.
What I have is a three.js scene in Template.home.rendered. I have created a "Part" collection and made all data available to both client and server. There is a single data fixture (document) with Part.insert({ name: "myPart", val: 75 });
.
I would like to able to return the value of the "val" field as a variable in the three.js scene like such var size = Part.findOne(Part.val);
. However, the variable returns undefined. The data has been successfully written to the database and the browser cache. What am I missing?
size = Part.findOne({name:"myPart"}).val;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.