0

Can I query elements of arrays which are inside documents instead of querying whole documents? I. e. I want to receive array elements, not documents. E. g., I have this:

{
  blog: 'blog1',
  comments:
  [{user: 'Alice', text: 'bla-bla-bla'}, {user: 'Sarah', text: 'bla-bla-bla'}, ...]
},
{
  blog: 'blog2',
  comments:
  [{user: 'John', text: 'bla-bla-bla'}, {user: 'Alice', text: 'bla-bla-bla'}, ...]
}

How can I get a list of comments written by Alice?

4

1 に答える 1

2

You can't do this yet. See https://jira.mongodb.org/browse/SERVER-828

于 2012-04-13T13:33:07.287 に答える