Add data inside documents in Mongo DB using PHP
问题 I want to insert data in Mongo database using PHP script, in year wise documents so that it may look like this (All years in one document); cars{ 2017{ car=Motorolla color = blue } 2016{ car=Toyota color = green } 2015{ car=Corolla color = black } } I wanted to add the document but it prompts Document can't have $ prefixed field names: $years[0] Is it possible to make such schema in Mongo using PHP? Code <?php try { $car = 'Motorolla'; $color = 'blue'; //$car = 'Toyota'; //$color = 'green'; /