var query = Query.EQ("x","123");database.GetCollection<MyDoc>("MyCollection").Distinct("Field",query);Distinct returns an IEnumerable<BSonValue> - does anyone know how to do run this using a cursor, so that I can take only the first x rows?
Thanks in advance,
Sam
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/Pyg12gUpryMJ.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
If there are 100,000 distinct values and you only want 100 of them which 100 do you want? A random 100?
There's probably something you can do with map/reduce, but how is going depend a lot to your answer to the above question.
On Fri, Apr 20, 2012 at 4:17 AM, Sam Martin <sambo...@gmail.com> wrote:
Hi Robert, thanks for answer - I was aware of the that doc.It's obviously not a C# driver issue, but are you aware of any alternative technique that would give me the same result?It doesn't make sense to take only a handful of results from 100,000's of records.If there are no additional parameters to the distinct command, then the only other way I can think of doing it is managing a distinct collection generated from a map/reduce?any thoughts/tips on this?
On 20 April 2012 05:13, Robert Stam <rob...@10gen.com> wrote:
At a lower level distinct is a database command and not a regular query. See:
What that means is that all the distinct values are returned at once in a single document, so there is no way to use the cursor to limit the number of distinct values returned.
On Thu, Apr 19, 2012 at 7:20 PM, Sam Martin <sambo...@gmail.com> wrote:
Take this example,var query = Query.EQ("x","123");database.GetCollection<MyDoc>("MyCollection").Distinct("Field",query);Distinct returns an IEnumerable<BSonValue> - does anyone know how to do run this using a cursor, so that I can take only the first x rows?Thanks in advance,
Sam
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/Pyg12gUpryMJ.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/mongodb-user/-/D-Xuh5O11BIJ.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.