Questions tagged [doctrine-odm]

Doctrine Object Document Mapper is built for PHP 5.3.2+ and provides transparent persistence between PHP objects and data stores such as MongoDB, CouchDB, OrientDB, and PHPCR.

Doctrine Object Document Mapper is built for PHP 5.3.2+ and provides transparent persistence between PHP objects and data stores such as MongoDB, CouchDB, OrientDB, and PHPCR.

Related links

538 questions
2
votes
1 answer

ODM: References not being created on both documents

Say I have two simple Documents like this, where a person can have many papers, but a paper can only belong to one person. namespace Dashboard\Document; use Doctrine\ODM\MongoDB\Mapping\ClassMetadata; use Doctrine\ODM\MongoDB\Mapping\Annotations as…
Nathan
  • 2,941
  • 6
  • 49
  • 80
2
votes
1 answer

Doctrine MongoDB ODM: must one call flush() after findAndUpdate()?

Empirically it seems that flush() is not necessary after findAndUpdate(), I just couldn't find this explicitly stated anywhere in the Doctrine ODM/MongoDB docs (and I didn't bother to read much source code). The findAndModify docs on mongodb.org…
Adam Monsen
  • 9,054
  • 6
  • 53
  • 82
2
votes
1 answer

how does one set default commit options for mongodb?

I'm using Doctrine MongoDB ODM in a Symfony2 application. How can I set default commit options (such as safe: 3 and fsync: true)? Ideally I'd be able to do this in my YAML config files, but the docs seem to indicate this isn't possible. If I can get…
Adam Monsen
  • 9,054
  • 6
  • 53
  • 82
1
vote
2 answers

Symfony2 mongodb bundle document one-to-many forms

I have a problem using forms in Symfony 2 with mongoDB documents. I'm trying to have a form that will represent my first document (Post) with a relation oneToMany to Tags (reference) The relation is declared like this : /** * @Assert\Collection *…
Bobby Six
  • 11
  • 3
1
vote
1 answer

doctrine odm set random value generated by js Math.random() on pre persist

i'm trying to implement this pattern http://cookbook.mongodb.org/patterns/random-attribute/ in doctrine odm. i would like to set this attribute on the pre-persist lifecycle event. To achieve the best results, i would like to use a native javascript…
bazo
  • 745
  • 9
  • 26
1
vote
2 answers

Why does Doctrine MongoDB ODM always return NULL?

I'm having trouble making this work in a fresh install /** * @Route("/bla") * @Template() */ public function blaAction() { $repository =…
HappyDeveloper
  • 12,480
  • 22
  • 82
  • 117
1
vote
3 answers

How to store a document inside another document, with Doctrine ODM?

How to store a document inside another document, with Doctrine ODM? I don't see an Array or Json type in the documentation. I would like to be able to do something like this: class Post { /** * @MongoDB\String */ protected…
HappyDeveloper
  • 12,480
  • 22
  • 82
  • 117
1
vote
1 answer

Push in Doctrine MongoDB ODM

I'm using Doctrine MongoDB ODM with Symfony 2.0.5 This code causes no effect: $dm = $this->get('doctrine.odm.mongodb.document_manager'); $dm->createQueryBuilder('AcmeMyBundle:Entry\Entry') ->field('comments2')->push('some…
User Created Image
  • 1,182
  • 2
  • 17
  • 33
1
vote
1 answer

Symfony MongoDb default sets empty array instead of not setting field

I've got a Document class with an EmbeddedDocument multiple self-inherited. It's working fine, but when i'm not sending subData it's saved in Mongo as empty array (subData: []). I would expect that this field isn't saved at all if not sent. I've…
1
vote
2 answers

MongoDB does not get updated

I use Doctrine 2 ODM\MongoDB (this and dependencies all latest from GIT) + PHP Mongo extension (v1.1.4) + Mongo (v1.8.3 x64 latest) In several cases it happens that when I change an entity, it does not get updated In an embedded entity I have a back…
NoxArt
  • 351
  • 3
  • 17
1
vote
2 answers

With doctrine ODM, can I embed many subdocuments in a main document?

I try to save this JSON: { "vendorId": "vendor-fc162cdffd73", "company": { "companyId": "bcos1.company.1806cf97-a756-4fbf-9081-fc162cdffd73", "companyVersion": 1, "companyName": "Delivery Inc.", "address": { …
Peter
  • 86
  • 1
  • 6
1
vote
0 answers

Doctrine doesn't read nested objects (embedded properties) in DocumentDB

I have a collection set up in DocumentDB. Let's call it persons_collection. Each document in this collection has an array of objects. Let's say it is a list of books each person read. So a sample document would look line this: { 'name': 'John', …
george007
  • 609
  • 1
  • 7
  • 18
1
vote
2 answers

Doctrine Mongo update $pull query not working

I'm attempting to remove references to a document (for the purpose of removing said document) using a $pull update query however nothing appears to be happening. I can manually run the following Mongo query db.collection.update({}, { $pull: { …
Phil
  • 157,677
  • 23
  • 242
  • 245
1
vote
2 answers

Doctrine MongoDB geoNear

I am trying to see how to do geoNear command without rewriting doctrine-mongodb project. I have looked through Expr.php and Builder.php files and I found no references to geoNear command, how can I get this functionality in my Doctrine MongoDB ODM…
MongoUser
  • 11
  • 2
1
vote
0 answers

PUT Operations in Symfony 5 and Doctrine ODM

We're developing an API on top of Symfony 5 using Doctrine ODM and MongoDB as well as API Platform. Problem is trying to support PUT operations. What we find is that if we PUT a JSON document with some fields not included, the object (eg $data)…