top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to use $sample functionality with the driver with Mongo

0 votes
302 views

I am trying to figuring out how to use $sample through the driver.
I know that there is the functionality, I just failed to comprehend how to use it...

posted Sep 29, 2016 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+1 vote

With the non-blocking asynchronous mongo java/scala driver, it is possible to define a wait time and a wait queue size for operations that cannot be executed directly with a free connection. When settings these values, the mongo driver will make the threads waiting for an available connection.

This behavior is very dangerous for an application written with non-blocking asynchronous IO in mind. These applications use a very limited number of threads (= numbers of cores). Blocking one of these thread can block the whole application.

What would be the recommended way to for this kind of applications? Should we set all these waiting settings to 0 and handle MongoWaitQueueFullException with retries in the application? Should the driver call an application callback when a connection is free?

+2 votes

Considering working with a shard replica-set cluster, some emergency such as re-pick primary node will happen and maybe we can retry the command several times for waiting for recover of mongo.

Is there anyone know when use c driver api such as mongoc_collection_update, mongoc_collection_commond, mongoc_collection_insert, which error codes tell me that I can retry command for making the application more robust.

+2 votes

I use the mongo c driver to operate the mongodb, I just wonder if the driver has the function of auto re-connection? And if I use a mongodb cluster with three shards, how can I connect all of the Mongos? And how can I do to switch to another mongos when i am using one of the mongos to operate the DB?

Any help is welcome.

0 votes

How could we use encrypted password in connection string? Let suppose if we are using below string:mongo localhost:27017/admin -u abc -p Test123

But we don't want the password to be publically visible directly in connection string.

Is there any way to use encrypted password?

0 votes

I am trying to use the truncate feature within YCSB to cause the db to truncate the data set to allow multiple runs against the DB to see the same DB state in spite of previous runs inserts.
I am using -p truncate=true. Is this the correct way to cause a truncate in Mongo.

...