Iam new to featherjs and i created one service called survey.this is my data model
'use strict';
// surveys-model.js - A mongoose model
//
// See http://mongoosejs.com/docs/models.html
// for more of what you can do here.
const mongoose = require('mongoose');
const Schema = mongoose.Schema;
const surveysSchema = new Schema({
ownerId: { type: String},
parentId: { type: String},//Id of campaign or the community
question: String,
votes: [{
voted:[String],
answer:{type:String,enum:['answer1','answer2']}
}]
});
const surveysModel = mongoose.model('surveys', surveysSchema);
module.exports = surveysModel;
i need to update the votes seperately according to the users voting..how i can do the update in the same service using the hook...please help me to find the answer.thanks in advance
Do you want to call another service inside the hook? If so, then they are available in hook.app.service
.
hook.app.service('servicename').update(...)