MongoDB 没有更新
我使用 Doctrine 2 ODM\MongoDB(这个和依赖项都是来自 GIT 的最新版本)+ PHP Mongo 扩展(v1.1.4)+ Mongo(最新的 v1.8.3 x64)
在某些情况下,当我更改实体时,它不会得到更新
在嵌入实体中,我有一个对其父级的反向引用,以解决 http://groups.google.com/group/doctrine-dev /browse_thread/thread/016422b2cc9dcec9?pli=1 (如何在嵌入文档中获取父文档?)而不使用像 UnitOfWork 这样的内部功能 - 这可能或可能不相关,我不知道...我希望不是(我的问题到目前为止是否在 IRC 上没有得到解答)
但是,角色的嵌入文档之一中的一个更改触发这些查询(实际上应该只与它相关,在它之前已经进行过刷新,并且记录器内部在更改之前再次设置的标志上有一个条件)
记录器转储:
array(6) {
"update" => TRUE
"query" => array(1) {
"_id" => MongoId(1) {
"$id" => "4e3143be662c32400d000006" (24)
}
}
"newObj" => array(1) {
"$set" => array(2) {
"components.destructible.hp" => 99.28706276
"options.character" => array(3) {
"$ref" => "characters" (10)
"$id" => MongoId(1) { ... }
"$db" => "nuclearRain" (11)
}
}
}
"options" => array(0)
"db" => "someDB" (11)
"collection" => "characters" (10)
}
array(6) {
"update" => TRUE
"query" => array(1) {
"_id" => MongoId(1) {
"$id" => "4e553306662c32680800054b" (24)
}
}
"newObj" => array(1) {
"$set" => array(1) {
"createdBy" => array(3) {
"$ref" => "characters" (10)
"$id" => MongoId(1) { ... }
"$db" => "nuclearRain" (11)
}
}
}
"options" => array(0)
"db" => "someDB" (11)
"collection" => "worlds" (6)
}
array(6) {
"update" => TRUE
"query" => array(1) {
"_id" => MongoId(1) {
"$id" => "4e553306662c32680800054c" (24)
}
}
"newObj" => array(1) {
"$set" => array(1) {
"world" => array(3) {
"$ref" => "worlds" (6)
"$id" => MongoId(1) { ... }
"$db" => "nuclearRain" (11)
}
}
}
"options" => array(0)
"db" => "someDB" (11)
"collection" => "games" (5)
}
初始化代码:http://pastebin.com/1dKagqry
"components.destructible.hp" => 99.28706276是核心部分->但这种更改从未反映在数据库中,
- 没有触发
- mongo 日志的
- php 错误/异常,一般情况下 Mongo 和 Doctrine\ODM\Mongo 运行良好,实体得到持久化、更新、删除...
我在哪里可以进一步搜索或我该怎么做才能解决这个问题 谢谢
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 reference to it's parent, to solve http://groups.google.com/group/doctrine-dev/browse_thread/thread/016422b2cc9dcec9?pli=1 (How to get parent document inside embedded document?) without using internal functionalities like UnitOfWork - this MAY or MAY NOT be relevant, I do not know... I would hope that not (my question whether it could went unanswered on the IRC so far)
However a single change in one of Character's embedded documents triggers these queries (should really be relevant only to it, there's been flush before it and a condition inside the logger on the flag that was set again right before the change)
Logger dump:
array(6) {
"update" => TRUE
"query" => array(1) {
"_id" => MongoId(1) {
"$id" => "4e3143be662c32400d000006" (24)
}
}
"newObj" => array(1) {
"$set" => array(2) {
"components.destructible.hp" => 99.28706276
"options.character" => array(3) {
"$ref" => "characters" (10)
"$id" => MongoId(1) { ... }
"$db" => "nuclearRain" (11)
}
}
}
"options" => array(0)
"db" => "someDB" (11)
"collection" => "characters" (10)
}
array(6) {
"update" => TRUE
"query" => array(1) {
"_id" => MongoId(1) {
"$id" => "4e553306662c32680800054b" (24)
}
}
"newObj" => array(1) {
"$set" => array(1) {
"createdBy" => array(3) {
"$ref" => "characters" (10)
"$id" => MongoId(1) { ... }
"$db" => "nuclearRain" (11)
}
}
}
"options" => array(0)
"db" => "someDB" (11)
"collection" => "worlds" (6)
}
array(6) {
"update" => TRUE
"query" => array(1) {
"_id" => MongoId(1) {
"$id" => "4e553306662c32680800054c" (24)
}
}
"newObj" => array(1) {
"$set" => array(1) {
"world" => array(3) {
"$ref" => "worlds" (6)
"$id" => MongoId(1) { ... }
"$db" => "nuclearRain" (11)
}
}
}
"options" => array(0)
"db" => "someDB" (11)
"collection" => "games" (5)
}
Initialization code: http://pastebin.com/1dKagqry
"components.destructible.hp" => 99.28706276 is the core part -> yet this change is never reflected in the DB
- there is no php error/exception triggered
- mongo's log shows no errors
- generally the Mongo and Doctrine\ODM\Mongo runs fine, entities get persisted, updated, deleted...
Where can I search further or what can I do to solve this issue
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这很尴尬,但问题是我想要对 EmbeddedDocuments 进行索引(如关联数组)...然而,这是在实际的 Doctrine 维护的属性上完成的,因此它触发了重新推送 EmbeddedDocument,放弃了更改
It is awkward, but the issue is that I wanted the EmbeddedDocuments indexed (like associative array)... this was however done on an actual Doctrine-maintained property, so it triggered re-pushing the EmbeddedDocument, discarding the changes