Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Selecting row from MongoDB

I am new to Phalcon ODM. I want to display all posts from post collection, which have post_type = blog. Here is the document

{
    "_id" : ObjectId("53f88231461584e41e00002a"),
    "post" : {
        "post_date" : "12-05-14",
        "post_title" : "Title",
        "post_content" : "Content",
        "post_category" : "test cat",
        "post_type" : "blog",
        "post_status" : "published",
        "post_modified" : "12-05-14"
    },
    "comment_status" : "open",
    "link_code" : "test-blog",
    "seo" : {
        "meta_desc" : "test desc",
        "meta_key" : "test key"
    }
}


15.5k
Accepted
answer

Finally I got the answer

$post = Posts::find(array(
                'conditions'=>array('post_con.post_type'=>'blog') ));
                $this->view->postlist = $post; 

The above code will select all blog posts.

In volt,

{% for posts in postlist %}
{{ posts.post_con['post_title'] }}
{{ posts.post_con['post_date'] }}

will do the job