I study mongodb and symfony. I succesfully creating a fields by following this documentation from symfony to mongodb link. If you can see documentation. They have these codes for connecting this documents to mongodb
/ src/Acme/StoreBundle/Document/Product.php
namespace Acme\StoreBundle\Document;
use Doctrine\ODM\MongoDB\Mapping\Annotations as MongoDB;
/**
* @MongoDB\Document
*/
class Product
{
/**
* @MongoDB\Id
*/
protected $id;
/**
* @MongoDB\Field(type="string")
*/
protected $name;
/**
* @MongoDB\Field(type="float")
*/
protected $price;
}
Is this possible adding another field in Product like category, and an under the category there are another fields like adding category_name and category_date? and how can I generate that document?
Update: I want to create like these flow of fields in my mongodb collections
Product
- id
- name
- price
- category
- category_name
- category_date