batch size question

2 views
Skip to first unread message

Randolph

unread,
Nov 26, 2010, 11:12:38 AM11/26/10
to Mongo node .js driver
Hi!

I have a question regarding implementing the batch size in the cursor.
What I have seen in the ruby driver is that it first performs a query,
disregarding the batch size, and gets an initial set of results from
the db. To get the remaining result, getMore should be used. It seems
like the batch size is only applicable to the getMore phase. Is my
understanding correct?

I am trying to perform tests on my code so I would like to know at
least how much result should I have to be able to reach the stage
where getMore will be called. Is this a predefined constant or is it
configurable somewhere?

Thanks!

Randolph

unread,
Nov 26, 2010, 3:38:57 PM11/26/10
to Mongo node .js driver
Follow-up question:
I am currently writing a test for batch size and limit
interoperability. What I found out so far is that the db always try to
fulfill the limit at the first batch (I even tried setting the limit
to 100000 with 100001 expected results), therefore, I had no chance to
use test my modification on using getmore is working properly. Do you
know how can I get around this?

Thanks!

Kristina Chodorow

unread,
Nov 26, 2010, 4:30:20 PM11/26/10
to mongo-node...@googlegroups.com
You should be able to set batch size for any batch, including the first.  If the Ruby driver doesn't allow that, it's incorrect.

Take a look at http://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProtocol-OPREPLY.  The database sends back a message that says "I'm returning 250 (or whatever) documents, here they are."  That's how the driver knows when getMore should be called.

Randolph

unread,
Nov 27, 2010, 8:00:21 PM11/27/10
to Mongo node .js driver
Thanks for the feedback. Here's the commit for my implementation:

https://github.com/kchodorow-corp/node-mongodb-native/pull/16

On Nov 26, 4:30 pm, Kristina Chodorow <krist...@10gen.com> wrote:
> You should be able to set batch size for any batch, including the first.  If
> the Ruby driver doesn't allow that, it's incorrect.
>
> Take a look athttp://www.mongodb.org/display/DOCS/Mongo+Wire+Protocol#MongoWireProt....
> The database sends back a message that says "I'm returning 250 (or whatever)
> documents, here they are."  That's how the driver knows when getMore should
> be called.
>

Pratik Daga

unread,
Nov 29, 2010, 3:49:05 PM11/29/10
to mongo-node...@googlegroups.com
apologies as I wont be able to show up before 5:30 today!
I hope that is fine =|
Reply all
Reply to author
Forward
0 new messages