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




--
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

Reply via email to