Drupal 7 Does “New Node Creation” initiate/prepare the Fields for different Content Types? In Drupal 7, i need to Programmatically create the Nodes. As usual, there are Different Fields set for Different Content Types.

For very simple example:

Content Type: "car"
Fields: "Model", "Engine", "GearType"

Content Type: "article"
Fields: "Title", "Author", "Media"


What i want to be confirmed here is, while i am creating a new node, for e.g by using:

$node = new stdClass();
$node-&gt;type = "car";


Then..


Is that (currently creating) new $node has been initiated/loaded with its related/corresponded fields, already before get saved?
To be more clear, if i just suddenly Save a node node_save($node) (without filling any other related fields) will that node be still having (following) its proper Content Type structure?
The node can have fields attached to it. If any are required and not provided then I believe your save() will fail with an error message. If your fields provide a default value that value will be used for those fields.

If there are no required fields. The basic node information (nid, type, title?) will be the only values set on your new node (and timestamps, owner uid).

I believe it's up to you the developer to assure the fields have the data you want when you save the node (and meet the Requirements of the node/fields configuration) from the Field UI.