Find documents with a duplicate in a subdocument

18 views
Skip to first unread message

Kenneth Truyers

unread,
Oct 2, 2014, 4:59:39 AM10/2/14
to rav...@googlegroups.com

Hi,

I have the following document structure:

{
    Name: "xyz",
    Sources: [
        {
            Id: 123,
            Name: "name"
        },
        {
           Id: 456,
           Name: "other name"
        }
    ]
}

I'm trying to write an index to find all the documents that have at least one source with the same name and id. Any idea how to do that?
I tried to do the following:

docs.mydocs.Where(e => 
docs.mydocs.Any(x => 
x.Sources.Any(di => 
e.Sources.Any(sourceDi => 
sourceDi.Id == di.Id && sourceDi.Name== di.Name
)
)
)
)
           .Select(doc=> new {doc.Name, doc.Sources})

I get a compilation error:
'System.Collections.Generic.IEnumerable<dynamic>' does not contain a definition for 'docs' and no extension-method is available...

Oren Eini (Ayende Rahien)

unread,
Oct 2, 2014, 6:13:41 AM10/2/14
to ravendb
Already answered in separate mail

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages