Message from discussion
How to connect to multiple mongod instances with c++ driver
Date: Mon, 24 Sep 2012 21:54:12 -0700 (PDT)
From: David Hows <david.h...@10gen.com>
To: mongodb-user@googlegroups.com
Message-Id: <0f9c80f5-e0dc-417d-85c4-caaab3352666@googlegroups.com>
In-Reply-To: <cc071176-7ba0-4e2b-9c3c-335cd9fbc90e@googlegroups.com>
References: <cc071176-7ba0-4e2b-9c3c-335cd9fbc90e@googlegroups.com>
Subject: Re: How to connect to multiple mongod instances with c++ driver
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="----=_Part_1539_12695818.1348548852656"
------=_Part_1539_12695818.1348548852656
Content-Type: multipart/alternative;
boundary="----=_Part_1540_5994843.1348548852657"
------=_Part_1540_5994843.1348548852657
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Thomas,
My understanding is that you have two independent mongod instances which
contain different data and must be queried independently. You wish to have
only one connection object (your hook as given) which will take all
database requests and then route them accordingly.
There is no way within mongo itself to hold two unrelated connections, to
different servers and deterministically route commands towards them. If you
wish to do this it would be best to extend your hook class to determine
from a given command which database it should use from your pool.
You can do this a number of ways ranging from a simple flag to select
database right through to pre-preparing a list of all databases and
collections and examining the query to determine where i should be routed.
If i have misunderstood any clarifications would be great,
Good luck,
David
------=_Part_1540_5994843.1348548852657
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Thomas,<div><br></div><div>My understanding is that you have two indep=
endent mongod instances which contain different data and must be queri=
ed independently. You wish to have only one connection object (your hook as=
given) which will take all database requests and then route them acco=
rdingly.</div><div><br></div><div>There is no way within mongo itself to ho=
ld two unrelated connections, to different servers and deterministical=
ly route commands towards them. If you wish to do this it would be bes=
t to extend your hook class to determine from a given command which databas=
e it should use from your pool. </div><div><br></div><div>You can do t=
his a number of ways ranging from a simple flag to select database right th=
rough to pre-preparing a list of all databases and collections and examinin=
g the query to determine where i should be routed.</div><div><br></div><div=
>If i have misunderstood any clarifications would be great,</div><div><br><=
/div><div>Good luck,</div><div><br></div><div>David</div>
------=_Part_1540_5994843.1348548852657--
------=_Part_1539_12695818.1348548852656--