0

Example first:

{ "_id" : ObjectId("4f086809bf28fd7bb56e6059"), "admins" : [ "4ef8e785b2694c3649000001" ], "pages" : [
    {
        "pagename" : "home",
        "title" : "homepage",
        "default" : true
    },
    {
        "pagename" : "people",
        "title" : "Staff",
        "default" : false
    }
], "sitename" : "Site", "sitenameLower" : "site" }

So that's the document I'm querying, now what I want is to return the 'page' where pagename = 'home'.

I've tried various queries but it always returns the whole document and not the individual object inside the pages array - which is not much use to me.

Including:

db.sites.find({'pages.pagename' : 'home'});

I can see, why this is wrong, but getting it right, is perplexing me.

1 Answer 1

0

See this question. Looks like it's a planned feature but you can't do it right now.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, ok I'll just refactor it, into another collection of pages. I've actually been thinking about how I do subsites and pages, so I may need to refactor it anyway... so that I have a collection of site items, namely pages, subsites, other lists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.