Vulcan/packages/nova-comments/lib/custom_fields.js

31 lines
643 B
JavaScript

Posts.addField([
/**
Count of the post's comments
*/
{
fieldName: "commentCount",
fieldSchema: {
type: Number,
optional: true,
public: true
}
},
/**
An array containing the `_id`s of commenters
*/
{
fieldName: "commenters",
fieldSchema: {
type: [String],
optional: true,
public: true,
join: {
joinAs: "commentersArray",
collection: "Users"
}
}
}
]);
Telescope.utils.addToFields(Posts.publishedFields.list, ["commentCount", "commenters"]);
Telescope.utils.addToFields(Posts.publishedFields.single, ["commentCount", "commenters"]);