|
Adding Multiple DocumentsIn order to do more interesting things with queries, let's add multiple simple documents to the collection. These documents will just be of the form array( "i" => value ); and we can do this fairly efficiently in a loop:
<?php Notice that we can insert arrays with different keys into the same collection. This aspect is what we mean when we say that MongoDB is "schema-free". In the example above each document has an i field, but also a field name in the form of field + $i. |