【发布时间】:2014-08-23 14:15:13
【问题描述】:
我正在使用 phalcon php 和 Mongo DB 开发一个应用程序。我想从以下文档中选择post_type = 'page'
{
"_id" : ObjectId("53f896db461584542200002b"),
"post_con" : {
"post_date" : "12-05-14",
"post_title" : "Test",
"post_content" : "test content",
"post_category" : "test cat",
"post_type" : "page",
"post_status" : "published",
"post_modified" : "12-05-14"
},
"comment_status" : "open",
"link_code" : "test-page",
"seo" : {
"meta_desc" : "test desc",
"meta_key" : "test key"
}
}
【问题讨论】:
-
你试过什么?这似乎是一个基本查询,应该在Phalcon documentation 中介绍。由于
post_type是嵌入文档,所以需要使用dot notation引用字段名(如“post_con.post_type”)。 -
感谢您的帮助。我得到了他的回答
标签: phalcon