Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with MongoDB 2.6 and CFMongoDB #46

Open
appdevjrcigars opened this issue Jul 2, 2014 · 4 comments
Open

Issues with MongoDB 2.6 and CFMongoDB #46

appdevjrcigars opened this issue Jul 2, 2014 · 4 comments

Comments

@appdevjrcigars
Copy link

It appears the find method is no longer returning records that match the criteria specified using MongoDB 2.6.x (did not work with 2.6.1 or 2.6.3)). A find is returning 0 results, regardless of the criteria, unless I put a limit. Limit is functioning, but it ignores any search criteria specified. The asArray() method is extremely slow and mostly returns error 500. Is anyone else seeing these problems?

@marcesher
Copy link
Owner

@appdevjrcigars I haven't tried CFMongoDB with mongo 2.6 yet (I rarely work in CF anymore, alas).

If you turn on profiling (db.setProfilingLevel(2)) to log all queries, do you see anything strange in there that would indicate why find() isn't returning results?

@appdevjrcigars
Copy link
Author

Thanks for your prompt reply. Turning on profiling helped indeed to see why 0 results are being returned since it revealed that, no matter how hard I try, if I query on a string field (e.g. trandate) that contains a string with only numeric values (e.g. "20140702"), the translation of the query from CFMongoDB to mongodb is an integer value instead of string. So for example, the query db.find({'trandate':'20140702'}).asArray() is interpreted as db.find({'trandate':20140702}).asArray(). I have tried double quotes, single quotes, quotes with extra quotes, converting the value toString(), etc., but to no avail. If I try a different CFMongoDB syntax (e.g. db.find(query={'trandate'='20140702'},sort={'trandate'=1}).asArray(), that's when I receive error 500s and 502s from the server, and I have to restart the CF Service to continue. I also tried the syntax db.query().$eq('trandate','20140702').find().asArray() and no luck. Unfortunately, I'm unable to determine why the CF Server crashes, but I'm assuming it is unable to parse the query correctly.
BTW, I'm using CF10 with MongoDB 2.6.3.

@appdevjrcigars
Copy link
Author

Thanks again...I just found a workaround right there in the examples:

mongoUtil = mongo.getMongoUtil();
get_allTransactionMetricsArray = db.find({'trandate': mongoUtil.asString("20140702")}).asArray();

The code above works perfectly. Thanks for your help.

@marcesher
Copy link
Owner

Great. Glad you got it working.

On Thursday, July 3, 2014, appdevjrcigars [email protected] wrote:

Thanks again...I just found a workaround right there in the examples:

mongoUtil = mongo.getMongoUtil();
get_allTransactionMetricsArray = db.find({'trandate':
mongoUtil.asString("20140702")}).asArray();

The code above works perfectly. Thanks for your help.


Reply to this email directly or view it on GitHub
#46 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants