Hi David,
Glad that fixed it, as for the mongo register function, what happens is
it ties a datasource name to one database. However you must still
provide a valid user with access to that database such as your admin
user. So its not that it doesnt support the admin user, its that each
datasource only binds to one database. For example lets say you do want
access to other databases, you could continue to use the admin user (a
user with easy access to all databases) but you would write several
mongoRegister functions to map seperate datasources for each database
you need to get to:
<cfset mongoRegister(name="firstDatabase", server="127.0.0.1",
db="mongoDB1", username="admin", password="adminPassword") />
<cfset mongoRegister(name="secondDatabase", server="127.0.0.1",
db="mongoDB2", username="admin", password="adminPassword") />
<cfset mongoRegister(name="thirdDatabase", server="127.0.0.1",
db="mongoDB3", username="admin", password="adminPassword") />
Im not sure if that answers your question, or I may have misunderstood
and you are really having user login issues with the admin user for
certain databases. But as you say that user does have access on other
mongo browser tools then it should have the same ability here, its just
that you need to map the databases to different datasources.
Hope this helps,
Jamie MacDonald.
On 05/01/2012 09:58, David Mulder wrote:
Thanks, that solved it, I copied the line from
http://www.openbd.org/manual/?/database_mongodb which apparently is
outdated?/incorrect in that case. (I expected something with my setup
to be wrong rather than with the code)
Concerning the second question, with the admin user (created in the
admin database) I can't directly login on any other database expect
the admin database, however in jMongoBrowser (GUI for mongoDB) I can
use the account to browse all databases, so it definitely has the
necessary priviliges (as per the docs (admin database users have
read/write priviliges to all databases)). I assumed that the way to
solve this was to log into the admin database first and next switch to
another database, but it could also mean the mongoregister function
doesn't support admin users?
David Mulder
On 4-1-2012 15:21, Jamie MacDonald wrote:
Hi David,
The documentation for the mongoCollectionFind function is here
http://www.openbd.org/manual/?/function/mongocollectionfind and it
looks like you have missed a parameter to keep things in order, I
believe this should fix it:
<cfset results = MongoCollectionFind("mongo", "mycoll", {age:
{"$gte": 40}}, {}, 0, 10) />
The first structure is the "where" arguments, and the second
structure would be fields you wish to bring back, but since you want
all of them you should be able to pass a blank structure for that.
For your second question I think you may just need to register 2
mongo datasources, as that is what currently defines the database to
use. I dont think that assignment can be changed on the fly BUT you
could simply delete old datasources when you no longer need them and
create new ones:
http://www.openbd.org/manual/?/function/mongoregister
http://www.openbd.org/manual/?/function/mongoderegister
Jamie MacDonald.
On 04/01/2012 13:57, David Mulder wrote:
Experimenting with mangodb quickly gave me an error page without any
specific error message (see attachment (the code is visible in the
attachment as well)). Anybody any idea what's wrong with it?
(And a second question, how can you use the "use databasename"
command from coldfusion, because I want to login (on development at
least) with an admin user, but the admin user is (if I understand is
correctly) specific for the admin database and can next write to all
other databases, so I need to login on the admin database first and
next switch to another one.)
David Mulder
--
aw2.0
http://www.aw20.co.uk/
--
online documentation: http://openbd.org/manual/
google+ hints/tips: https://plus.google.com/115990347459711259462
http://groups.google.com/group/openbd?hl=en
Join us @ http://www.OpenCFsummit.org/ Dallas, Feb 2012