Skip to content
This repository was archived by the owner on Oct 23, 2023. It is now read-only.
This repository was archived by the owner on Oct 23, 2023. It is now read-only.

How can I transfer the information from mongodb database to dialogflow with node.js? #347

@usuario12345679

Description

@usuario12345679

Good afternoon I need help because the designed program shown below manages to transfer the information to the consolelog but it is not able to send it to dialogflow through agent.add function. In mongo db database is the information of people with name, department, position and mail. From dialogflow it will receive the position and the department, and the program must be able to search in the mongodb database a person who fullfils those two requirements and send all the information back to dialogflow. I think the key is to use the find() function and then know how to take that information to an array, but I don't know how. Any help is appreciated. (All functions for connecting to moongose are assumed to be OK.)

`function ConsultarDepartament(agent) {

    var departament = agent.parameters.departamentos;
    var cargo = agent.parameters.cargodepartamento;

   contactodepartamento.find({departament : 'departament', cargo : 'cargo'}) 
             .exec((err, res)=>{
       if(err) return console.log('Error ' + err)
          else console.log(res);

               });
      agent.add('The name and email of the person you are looking for is: '+);
     }`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions