Mongo distinct and embedded list (Query)
Having a collection of logbooks with logs

    { 
    type:'logbook',
    name:'my book',
    userRef:2,
    cdate: ....,
    logs: [
      { 
          color: 'red',
          weight: 200,
          cdate: ...,
          foo: 'bar'
      },
      { 
          color: 'blue',
          weight: 100,
          cdate: ...,
          foo: 'bar'
      },
      { 
          color: 'green',
          weight: 240,
          cdate: ...,
          foo: 'bar'
      }
    ]

How can I get distinct color for a given logbook item ?

I tried

    db.dgacavionlogbook.distinct("logs.aeronef.type", {name: 'DGAC'})

http://www.mongodb.org/display/DOCS/Aggregation

With no success :/



Mongo distinct and embedded list (Query)
===

Having a collection of logbooks with logs

    { 
    type:'logbook',
    name:'my book',
    userRef:2,
    cdate: ....,
    logs: [
      { 
          color: 'red',
          weight: 200,
          cdate: ...,
          foo: 'bar'
      },
      { 
          color: 'blue',
          weight: 100,
          cdate: ...,
          foo: 'bar'
      },
      { 
          color: 'green',
          weight: 240,
          cdate: ...,
          foo: 'bar'
      }
    ]

How can I get distinct color for a given logbook item ?

I tried

    db.dgacavionlogbook.distinct("logs.aeronef.type", {name: 'DGAC'})

http://www.mongodb.org/display/DOCS/Aggregation

With no success :/


