Как обновить данные mongodb, используя hook in featherjs?

Я новичок в featherjs, и я создал один сервис под названием survey.this моя модель данных

'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;

мне нужно обновить голоса отдельно в зависимости от голосования пользователей.. как я могу сделать обновление в том же сервисе, используя хук... пожалуйста, помогите мне найти ответ. Спасибо заранее

1 ответ

Решение

Вы хотите позвонить в другой сервис? Если так, то они доступны в hook.app.service,

hook.app.service('servicename').update(...)
Другие вопросы по тегам