草庐IT

Doctrine_Record

全部标签

mongodb - Doctrine QueryBuilder 不与 DBRef 一起工作

我目前在posts集合的文档上有一个字段,它是用户集合的ReferenceOne。在shelldb.posts.findOne({"usuario_stream.$id":ObjectId("5012d7674dfbad7f4e000084")})上查询工作正常,但使用QueryBuilder它根本行不通。$this->doctrine->createQueryBuilder('Documents\Posts')->field('usuario_stream.$id')->equals(newMongoId('5012d7674dfbad7f4e000084'))->eagerCurs

php - 使用 Doctrine 向 MongoDB 集合中插入大量数据

我正在为一个应用程序使用Doctrine和MongoDB,并且有一个任务应该将数据从CSV文件导入到一个集合中。大约有5个不同的CSV文件,每个文件至少有450.000个条目,每年应该重要1到3次。目前我遍历文件的所有行,创建一个对象,调用persist()并每2.500个项目刷新一次。每个项目都不是很大,有一个ID,一个10-20个字符的字符串,一个5-10个字符的字符串和一个bool值。我的第一个问题是:当我每5.000个项目刷新一次时,插入速度会明显变慢。在我的测试环境中,刷新5.000个项目大约需要102秒,刷新2.500个项目大约需要10秒。一段时间后刷新变慢。如前所述,一开

mongodb - Doctrine mongo组查询

我在使用doctrinemongodb实现groupBy时遇到问题。我遵循了这两个指南:http://cookbook.mongodb.org/patterns/unique_items_map_reduce/http://docs.doctrine-project.org/projects/doctrine-mongodb-odm/en/latest/reference/query-builder-api.html确切地说,我想创建这个groupBy:“select*fromfontswhere1groupbyfamily”这是我的代码,但不起作用:$queryBuilder=$th

mongodb - fatal error : Class 'Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle' not found

自3天以来我一直在尝试安装mongodb,但每次我都会收到不同的错误消息,直到我修复了其中的一些错误并且我可以为我的Symfony2.1.4安装安装mongodb。所以现在我收到此错误消息:"Fatalerror:Class'Doctrine\Bundle\MongoDBBundle\DoctrineMongoDBBundle'notfound"我找不到任何解决方案来解决它。对于我的composer.json中的信息,我添加了这些行:"doctrine/mongodb-odm":"*","doctrine/mongodb-odm-bundle":"v2.0.1"它在Doctrine命名

mongodb - Doctrine ODM : How to select Mongo DB database

我使用doctrineODM从我的Mongo数据库中保存和加载文档。我遵循了本指南:https://doctrine-mongodb-odm.readthedocs.org/en/latest/tutorials/getting-started.html遵循本指南,所有文档默认都存储在数据库“doctrine”中。但是如果我有自己的数据库呢?如何选择数据库?我在文档和谷歌中都找不到任何有用的东西。 最佳答案 您可以使用配置类。$config->setDefaultDB('mydbname');

javascript - meteor JS : How do I access the previous record in a collection?

我有一个集合中的消息列表。在呈现集合中的每条消息时,我想将消息的时间戳和userId与上一条消息进行比较。但是,我不确定如何访问数据来进行比较。任何建议将不胜感激。这是我的模板:{{#eachmessages}}{{>messageItem}}{{/each}}{{userName}}{{body}}这是我的助手文件:Template.messageItem.helpers({nameVisibility:function(){//Notsurehowtoquerythepreviousmessageinrelationtothisone.previousMessage=Message

mongodb - 路径 "doctrine_mongodb.connections"的类型无效。预期的数组,但得到了字符串

我对编码和这个网站还很陌生,所以对于我会和/或不会犯的错误,我深表歉意。我正在尝试为mongoDB生成setter和getter(使用symfony3)但是当我输入控制台时phpC:\wamp64\www\test\app\consoledoctrine:mongodb:generate:documentsMainBundle我收到这个错误:[Symfony\Component\Config\Definition\Exception\InvalidTypeException]Invalidtypeforpath"doctrine_mongodb.connections".Expecte

mongodb - Doctrine EventListener onFlush 获取旧 Document

我可以在Doctrine2的onFlusheventListerner中访问更新的文档。我想要完整的旧文档以旧状态将其存储在其他地方。publicfunctiononFlush(OnFlushEventArgs$eventArgs){$dm=$eventArgs->getDocumentManager();$uow=$dm->getUnitOfWork();foreach($uow->getScheduledDocumentUpdates()as$document){//$documentisupdateddocument//$changeSetcontainsonlynewandol

php - 什么是 PHP Doctrine MongoDB ODM 中的鉴别器字段冲突?

报错是什么意思Discriminatorfield"x"in"y"conflictswithamappedfield's"name"attribute.被抛出?更具体地说,我指的是这种情况:if($this->discriminatorField!==null&&$this->discriminatorField===$mapping['name']){throwMappingException::discriminatorFieldConflict($this->name,$this->discriminatorField);}ReferalCode 最佳

mongodb - Doctrine/MongoDB : Use key-value pairs instead numeric array

我正在将DoctrineODM与MongoDB结合使用。我有一个这样的“产品模型”:namespaceCms\Model;/**@Document(collection="products")*/classProduct{/**@Id*/private$id;/**@String*/private$title;/**@String*/private$description;/**@Date*/private$createdAt;/**@EmbedMany(targetDocument="Cms\Model\ProductParam")*/private$params;/**@Embed