MongoDB extension

Does anyone know how to authenticate a connection? I think db.auth worked
with the last version of the mongodb extension but does not seem
to work with current version 3.2, lucee error on db.auth function does not
exist, it does work when added to a mongo: uri string but it connects and
then
closes with each db call.

thanks,
Mark.

auth() was removed in favor of using the MongoDB connection string method of authentication.

I believe the syntax is something like this, but verify with the MongoDB Java driver docs to be sure.

db = MongoDBConnect("mongodb://user:password@localhost:27017/test”);> On Jul 2, 2016, at 11:05 PM, mark <@mark> wrote:

Does anyone know how to authenticate a connection? I think db.auth worked with the last version of the mongodb extension but does not seem
to work with current version 3.2, lucee error on db.auth function does not exist, it does work when added to a mongo: uri string but it connects and then
closes with each db call.

thanks,
Mark.


Win a ticket to dev.objective from Lucee via Twitter, see http://bit.ly/1UbTMWj for details, good luck and see you there…

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/8b61539a-1a3e-4fee-9fdd-b850c80bba65%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Thanks for the quick reply,

as mentioned in my previous post it is possible to connect with a mongo:uri
string but you have to specify the database first,

db = MongoDBConnect(“testdb”, “mongodb://user:password@localhost:27027”);

if you do a dump

dump(var:db, expand:true);

it doesn’t seem to reuse the connection,

2016-07-04T11:55:07.104-0500 I ACCESS [conn120] Successfully
authenticated as
principal public on admin
2016-07-04T11:55:09.991-0500 I NETWORK [initandlisten] connection accepted
from
127.0.0.1:8498 #121 (121 connections now open)
2016-07-04T11:55:10.018-0500 I ACCESS [conn121] Successfully
authenticated as
principal user on admin
2016-07-04T11:55:10.019-0500 I NETWORK [initandlisten] connection accepted
from
127.0.0.1:8499 #122 (122 connections now open)
2016-07-04T11:55:10.039-0500 I ACCESS [conn122] Successfully
authenticated as
principal user on admin
2016-07-04T11:55:50.372-0500 I NETWORK [conn118] end connection
127.0.0.1:8495
(121 connections now open)
2016-07-04T11:56:07.059-0500 I NETWORK [conn120] end connection
127.0.0.1:8497
(120 connections now open)
2016-07-04T11:56:09.990-0500 I NETWORK [conn122] end connection
127.0.0.1:8499
(119 connections now open)On Saturday, July 2, 2016 at 9:05:33 PM UTC-5, mark wrote:

Does anyone know how to authenticate a connection? I think db.auth worked
with the last version of the mongodb extension but does not seem
to work with current version 3.2, lucee error on db.auth function does not
exist, it does work when added to a mongo: uri string but it connects and
then
closes with each db call.

thanks,
Mark.

Hey Sean,
after digging a little deeper and testing the older driver it seems as
though neither mongodb extensions create
a connection pool? Or is there something I’m missing.On Saturday, July 2, 2016 at 9:05:33 PM UTC-5, mark wrote:

Does anyone know how to authenticate a connection? I think db.auth worked
with the last version of the mongodb extension but does not seem
to work with current version 3.2, lucee error on db.auth function does not
exist, it does work when added to a mongo: uri string but it connects and
then
closes with each db call.

thanks,
Mark.

Ok nevermind,

it’s kind of weird but when you do
a db=MongoDBConnect(“testdb”,“localhost”, 27017); the connection pool seems
to work fine
but this will create a new connection on each call,
db=MongoDBConnect(“testdb”, “mongodb://localhost:27017”);,
did as you suggested and it works just dandy. application.mongo =
MongoDBConnect(“testdb”, “mongodb://localhost:27017”);

thanks for clearing that up Sean.On Sunday, July 10, 2016 at 11:33:19 AM UTC-5, Sean Daniels wrote:

Hey Sean,
after digging a little deeper and testing the older driver it seems as
though neither mongodb extensions create
a connection pool? Or is there something I’m missing.

Sorry, been on vacation. I do not believe the extension uses connection
pooling like a traditional DB driver. When you call MongoDBConnect it
creates a single MongoClient. It’s up to you to persist this connection in
your application.

application.mongo = MongoDBConnect(uri);

Hey Sean,
after digging a little deeper and testing the older driver it seems as though neither mongodb extensions create
a connection pool? Or is there something I’m missing.

Sorry, been on vacation. I do not believe the extension uses connection pooling like a traditional DB driver. When you call MongoDBConnect it creates a single MongoClient. It’s up to you to persist this connection in your application.

application.mongo = MongoDBConnect(uri);

Not sure if you are interested or what your need for extension is but I
have a cfc that does mongo operations. It does not implement everything but
you may find it useful as a start place. I use it in my sites and have
never had an issue. I have not added authentication since my mongo servers
are isolated locally and don’t require it. but adding it should be simple
enough.

Not sure if I am being helpful or muddying the waters, let me know if I can
help.On Tuesday, July 5, 2016 at 3:14:13 PM UTC-7, mark wrote:

Hey Sean,
after digging a little deeper and testing the older driver it seems as
though neither mongodb extensions create
a connection pool? Or is there something I’m missing.

On Saturday, July 2, 2016 at 9:05:33 PM UTC-5, mark wrote:

Does anyone know how to authenticate a connection? I think db.auth worked
with the last version of the mongodb extension but does not seem
to work with current version 3.2, lucee error on db.auth function does
not exist, it does work when added to a mongo: uri string but it connects
and then
closes with each db call.

thanks,
Mark.

No problem Mark. I’ll add something about this to the ReadMe in GitHub.> On Jul 10, 2016, at 6:55 PM, mark <@mark> wrote:

Ok nevermind,

it’s kind of weird but when you do a db=MongoDBConnect(“testdb”,“localhost”, 27017); the connection pool seems to work fine
but this will create a new connection on each call, db=MongoDBConnect(“testdb”, “mongodb://localhost:27017”);,
did as you suggested and it works just dandy. application.mongo = MongoDBConnect(“testdb”, “mongodb://localhost:27017”);

thanks for clearing that up Sean.

On Sunday, July 10, 2016 at 11:33:19 AM UTC-5, Sean Daniels wrote:

Hey Sean,
after digging a little deeper and testing the older driver it seems as though neither mongodb extensions create
a connection pool? Or is there something I’m missing.

Sorry, been on vacation. I do not believe the extension uses connection pooling like a traditional DB driver. When you call MongoDBConnect it creates a single MongoClient. It’s up to you to persist this connection in your application.

application.mongo = MongoDBConnect(uri);


Win a ticket to dev.objective from Lucee via Twitter, see http://bit.ly/1UbTMWj for details, good luck and see you there…

You received this message because you are subscribed to the Google Groups “Lucee” group.
To unsubscribe from this group and stop receiving emails from it, send an email to lucee+unsubscribe@googlegroups.com.
To post to this group, send email to lucee@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/lucee/2ab7566a-a62e-46e4-be14-209bb65e6ac4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.