Update mongodb collection with a object via eloquent

  eloquent, laravel, mongodb, php

I would like to save the following object to a field on a mongodb collection via eloquent

 "project_settings" : {
    "resource" : true,
    "zone" : true,
    "contractor" : true,
    "responsible_person" : false
 }

this is my php code:

return ProjectModel::where($project_id)->first()->update($project_data);
          

dont worry about the model it works fine i need to make a query that updates the project collection

and $project_data =

project_settings:array(4)
  resource:true
  zone:true 
  contractor:true
  responsible_person:true

Right now i get no error back. It returns successful but nothing is updated in reality. Can someone help?

Source: Laravel

Leave a Reply