php-doc-en/reference/mongo/mongoid.xml
Kristina Chodorow 7214d04a66 updates for 1.0.11 release
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@305112 c90b9560-bf6c-de11-be94-00142212c4b1
2010-11-05 21:42:01 +00:00

123 lines
3.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision$ -->
<phpdoc:classref xml:id="class.mongoid" xmlns:phpdoc="http://php.net/ns/phpdoc" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude">
<title>The MongoId class</title>
<titleabbrev>MongoId</titleabbrev>
<partintro>
<!-- {{{ MongoId intro -->
<section xml:id="mongoid.intro">
&reftitle.intro;
<para>
A unique identifier created for database objects. If an object is inserted
into the database without an _id field, an _id field will be added to it
with a <classname>MongoId</classname> instance as its value. If the data
has a naturally occuring unique field (say, a username or timestamp) it is
fine to use this as the _id field instead, and it will not be replaced with
a <classname>MongoId</classname>.
</para>
<para>
Instances of the <classname>MongoId</classname> class fulfill the role that
autoincrementing does in a relational database: to provide a unique key if
the data does not natually have one. Autoincrementing does not work well
with a sharded database, as it is impossible to find what the next number
should be quickly. This class fulfills the constraints of quickly
generating a value that is unique across shards.
</para>
<para>
Each MongoId is 12 bytes (making its string form 24 hexidecimal characters).
The first four bytes are a timestamp, the next three are a hash of the
client machine's hostname, the next two are the two least significant bytes
of the process id running the script, and the last three bytes are an
incrementing value.
</para>
<para>
<classname>MongoId</classname>s are serializable/unserializable. Their
serialized form is similar to their string form:
<screen>
<![CDATA[
C:7:"MongoId":24:{4af9f23d8ead0e1d32000000}
]]>
</screen>
</para>
</section>
<!-- }}} -->
<section xml:id="mongoid.synopsis">
&reftitle.classsynopsis;
<!-- {{{ Synopsis -->
<classsynopsis>
<ooclass><classname>MongoId</classname></ooclass>
<!-- {{{ Class synopsis -->
<classsynopsisinfo>
<ooclass>
<classname>MongoId</classname>
</ooclass>
</classsynopsisinfo>
<!-- }}} -->
<fieldsynopsis>
<modifier>public</modifier>
<type>string</type>
<varname>$id</varname>
<initializer>&null;</initializer>
</fieldsynopsis>
<classsynopsisinfo role="comment">&Methods;</classsynopsisinfo>
<xi:include xpointer="xmlns(db=http://docbook.org/ns/docbook) xpointer(id('class.mongoid')/db:refentry/db:refsect1[@role='description']/descendant::db:methodsynopsis[1])" />
</classsynopsis>
<!-- }}} -->
</section>
<section>
<title>Fields</title>
<variablelist>
<varlistentry>
<term>$id</term>
<listitem>
<simpara>
This field contains the string representation of this object.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</section>
<section>
&reftitle.seealso;
<para>
MongoDB core docs on <link xlink:href="&url.mongodb.dochub.objectids;">ids</link>.
</para>
</section>
</partintro>
&reference.mongo.entities.mongoid;
</phpdoc:classref>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"~/.phpdoc/manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->