Imagine that you have a collection similar to the following ...
tests = [ Name: 'Some Test', Question: [Question: 'Answer the life, the universe and everything?', Answer: '42'}, {Question: 'What is your favorite color?', Answer: 'Blue'} , {Question: 'European Sloan Unladen of Airspeed Velocity', Answer: '24 mph'}]}];
How do you publish the entire collection apart from the property?
I understand that you can do the following to release properties from the following:
Meteor.publish ('test ', Function () {return test. Search ({}, {fields: {name: 0}})}}
But I'm not sure how to get an array property from one To end the property.
Thank you!
The way you use it Want to do this, it can not be done. The L-field supports the specifiers, which are 1 level deep. You can sometimes get a sub-region specification to work, but this is not reliable.
A test ID can be kept in the collection, which adds them to the test, relational style. A question per document, and then you will be able to specify that only question field lighting Will be deleted.
Meteor.publish ('questions', function (testId) {return questions.find ({TestId: testId}, {fields: {question: 1}})}) ;
This is not ideal, but it is very painless compared to trying to find an alternative solution that allows your questions to be in the test document.
One way to do this may be to manually add more that it gets published with an answer.
No comments:
Post a Comment