I'm trying to move from MySQL to MongoDb, and start creating a test
class:

<?php

namespace Bundle\TestBundle\Document;

/**
 * User
 * Represents a particular user.
 *
 * @Document(db="test_db", collection="users")
 */
class User
{
    /** @Id */
    private $id;

    /** @String */
    private $userName;

    /** @BinMD5 */
    private $userPassword;

...

I have added to the config.yml:

doctrine_odm.mongodb: ~

then tried to run the following to create a new user:

$dm = $this->container-

>getDoctrine_Odm_Mongodb_DefaultDocumentManagerService();

$user = new User();
$user->setName('John Doe);
$dm->persist($user);
$dm->flush();

But I keep getting this error:

"No identifier/primary key specified for Document &#039;Bundle
\TestBundle\Document\User&#039;. Every Document must have an
identifier/primary key."

Any ideas why this is happening?

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to symfony-users@googlegroups.com
To unsubscribe from this group, send email to
symfony-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to