Message from discussion
Remove nested document with condition
Received: by 10.236.85.176 with SMTP id u36mr10261123yhe.45.1353352948379;
Mon, 19 Nov 2012 11:22:28 -0800 (PST)
X-BeenThere: mongodb-user@googlegroups.com
Received: by 10.49.133.170 with SMTP id pd10ls1878633qeb.60.gmail; Mon, 19 Nov
2012 11:22:09 -0800 (PST)
Received: by 10.224.186.20 with SMTP id cq20mr9287340qab.8.1353352929592;
Mon, 19 Nov 2012 11:22:09 -0800 (PST)
Received: by 10.224.16.202 with SMTP id p10msqaa;
Mon, 19 Nov 2012 11:13:32 -0800 (PST)
Received: by 10.49.72.40 with SMTP id a8mr2802282qev.13.1353352412164;
Mon, 19 Nov 2012 11:13:32 -0800 (PST)
Date: Mon, 19 Nov 2012 11:13:31 -0800 (PST)
From: SD <snehadeepset...@gmail.com>
To: mongodb-user@googlegroups.com
Message-Id: <810c1bdf-b25f-4f62-b332-53c2a748ee01@googlegroups.com>
In-Reply-To: <a8d7fb65-dcae-4df2-8cb6-ed846130f687@googlegroups.com>
References: <819551a1-b9d8-4b24-a39d-c9a27f7d0a16@googlegroups.com>
<a8d7fb65-dcae-4df2-8cb6-ed846130f687@googlegroups.com>
Subject: Re: Remove nested document with condition
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_168_9413376.1353352411304"
------=_Part_168_9413376.1353352411304
Content-Type: multipart/alternative;
boundary="----=_Part_169_1478331.1353352411304"
------=_Part_169_1478331.1353352411304
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
That helps, thanks for the example.
On Thursday, November 15, 2012 12:59:02 PM UTC-6, Ronald Stalder wrote:
>
> I can think of two possibillities:
>
> (a) find all the documents with dogs, for each document found loop the
> pets to find the lowest dog, then remove it:
>
> (b) use aggregate or mapReduce to find the lowest dogs per _id and remove
> it
>
> You can find an analog expample (for node.js) on
> https://gist.github.com/4080463 (the mapReduce (2nd file) actually doesnt
> remove the lowest score but you can add this to the finalize function
>
> cheers
>
>
>
------=_Part_169_1478331.1353352411304
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: 7bit
That helps, thanks for the example.<br><br>On Thursday, November 15, 2012 12:59:02 PM UTC-6, Ronald Stalder wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">I can think of two possibillities:<div><br></div><div>(a) find all the documents with dogs, for each document found loop the pets to find the lowest dog, then remove it:</div><div><br></div><div>(b) use aggregate or mapReduce to find the lowest dogs per _id and remove it<br></div><div><br></div><div>You can find an analog expample (for node.js) on <a href="https://gist.github.com/4080463" target="_blank">https://gist.github.com/<wbr>4080463</a> (the mapReduce (2nd file) actually doesnt remove the lowest score but you can add this to the finalize function</div><div><br></div><div>cheers</div><div><br><br></div></blockquote>
------=_Part_169_1478331.1353352411304--
------=_Part_168_9413376.1353352411304--