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
SERVER-5319 $strlen for aggregation framework #213
Conversation
assert(arrayEq(slen.result, slenresult), 'strlen1 failed'); | ||
|
||
// $strlen on nonexistent field should return a "not a string" | ||
// error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think $strlen on a nonexistent field should return zero. This fits the operation of other operators, which are as forgiving as possible unless the result is definitively wrong. Here, I think it makes sense to treat this as an empty string. However, I think it should be an error to call $strlen on a real field that does not contain a string value.
Generally looks good, but as noted, I'd return zero for missing or null valued fields. Also, we shouldn't turn off those assertions, since they appear to work for everyone else. Can you describe what was causing them to go off for you? Did you look at the value of millis in the debugger and see what it is? |
I uncommented the time stuff and it works now. I wish I knew why it works I added in the checks you recommended, but for some reason the tests just
pString(vpOperand[0]->evaluate(pDocument));
Thanks! (And I guess I'll see you on Friday!) On Wed, May 2, 2012 at 2:41 PM, Chris Westin <
Annie™ |
What do you mean "it skips over it?" Is it not executing the condition? That would be a sign of not having recompiled this file in the executable you're running (presuming you're checking this in the debugger). Or, are you saying the condition isn't true for non-existent fields? In that case, what is the type of pString for a non-existent field? Either way, something sounds fishy here. Please dig into the details and let me know more. |
the condition probably just isn't true, because i've recompiled everything i can't figure out how check the value because i can't get gdb to work with I'm really confused..can you help? My default sanity check--just reading the code--is failing me because if Thanks! On Mon, May 7, 2012 at 3:25 PM, Chris Westin <
Annie™ |
Don't bother trying to run the debugger on mongo. mongo is just the client shell, which communicates with the mongod server, where everything interesting is happening. You want to run the debugger on mongod. If you're starting it from within emacs (which is the thing to do), start it via gud, that usually hooks up with the client program much more easily. I'm assuming you're using some system that's got a bit-mapped windowing system, yes? Run mongod under the debugger in one window while you connect to mongod from the mongo shell from another window. |
I don't know how to use emacs; i (try to) use vim :\ I also don't know what For BSONType t = pString->getType(); (gdb) print pE So it looks like neither of them are NULL. Should I be checking Thanks!
Annie™ |
A bit mapped windowing system is one that uses a graphical user interface to show you multiple windows. From your earlier comments about not being able to run the debugger and the mongo shell, it sounded like you were limited to one shell (terminal) for some reason. Yes, check for Undefined as well. I forgot that could be one of the values coming through. It looks like you added that. Is the test working as expected now? |
Yes, the test works now! On Thu, May 10, 2012 at 3:47 PM, Chris Westin <
Annie™ |
Hi Annie, Do you still have any interest in continuing to work on this pull request? If you do, please sign the contributor's agreement and we'll start the review process (again). Regards, |
Nope, sorry..that was a really long time ago :( On Mon, Jun 30, 2014 at 8:36 PM, Benety Goh notifications@github.com
Annie™ |
No problem. Closing! |
So how do we find the length of a string in MongoDB? Is there a solution now? |
PSMDB-123 Handle WT backup when directoryperdb or wiredTigerDirectoryForIndexes is set
initial implementation and tests