Question: I have setup a fully operational chat bot in Hangouts Chat orchestrated by a tailored webserver. I would like now to be able to have this webserver to interact with other Hangouts bots that I created and to route some requests to some of my other servers that will have to know which bots initiated the event.
With other provider, such as Slack, the app\_id is provided in the event request data.
But with hangouts, this is not the case. I could not find any data in the request body or headers that represent either project\_id or client\_id.
In a more simple way my question is : "How to identify the Hangouts bot that send me an event request?" :)

Answer: 
You ca only use `findByIdAndUpdate` when you want to update the document by matching the `_id` of the document

If you want to match the document by any other property (such as `name` in your case), you can use `findOneAndUpdate`

Write your query like this

```
router.put('/:name', function(req,res,next) {
    Buttons.findOneAndUpdate({name: req.params.name},         
 req.body).then(function(){
    Buttons.findOne({name: req.params.name}).then(function(buttons){
        res.send(buttons);
    });
});
 });

```

Hope this helps
Please add your id as well which you have to update in your database

```
Model.findByIdAndUpdate(id, updateObj, {new: true}, function(err, model) {...

```

This error occur because findByIdAndUpdate need id of an Object which we want to update so it shows ObjectId error. so pass your id from front end and use it in your back-end to update particulate data. 

step 1 : you can create new endpoint for update-name

```
router.put('/update-name', function(req,res,next) {
  //here you can access req.body data comes from front-end
 // id = req.body.id and name = req.body.name then use it in your 
 Buttons.findByIdAndUpdate(id, { name : name }, {new: true}, function(err, model) {...

}

```

step 2 : try this endpoint /update-name and pass your data in Body from postman