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
multiple synchronous requests now possible; additional ObjectID stuff #12
base: master
Are you sure you want to change the base?
Conversation
…ionality heavy edits to Wire.as to allow multiple synchronous requests (by using multiple sockets); previously, multiple requests at the same time would fail silently. now that Wire manages multiple Socket instances (via RequestSequence), DB.connect() is no longer necessary. just make requests directly. error handlers are still piped back up via DB error Signals. moved Wire away from dependency on Signals, though they're still used throughout the rest of MongoAS3. added new ObjectID generation (so inserts don't have to getLastError to access an ObjectID generated by the server on a newly-inserted document). added timestamp extraction to ObjectID. sorry about formatting differences from original MongoAS3.
|
||
/** | ||
* ERICSOCO ADDED | ||
* I hate this fucking Document class....so bloated. |
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.
The reason I had to add this Document class is because the authentication command sent to MongoDB has to have the keys encoded in the correct order. Ideally I wanted to use plain Object type to create command structures to send to MongoDB, but because Object is a dynamic class the properties can not be iterated in a predictable order, so I made this Document object w/ the put() method.
Do you have any suggestions for an alternate solution that would let the driver enumerate over keys in an ordinal manner?
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.
yikes! sorry. didn't mean to leave that comment in, it was in a moment of frustration...i apologize.
i'm not working with authentication, so hadn't run across that issue. in the meantime, please let me remove that comment.
so sorry about that. really appreciate the work you did on this project, it's a huge leap forward from ActionMongo.
-eric
On Apr 5, 2012, at 2:49 PM, Omar Gonzalez wrote:
@@ -71,6 +71,17 @@ package as3.mongo.db.document
{
return _values[index];
}
/**
\* ERICSOCO ADDED
\* I hate this fucking Document class....so bloated.
The reason I had to add this Document class is because the authentication command sent to MongoDB has to have the keys encoded in the correct order. Ideally I wanted to use plain Object type to create command structures to send to MongoDB, but because Object is a dynamic class the properties can not be iterated in a predictable order, so I made this Document object w/ the put() method.
Do you have any suggestions for an alternate solution that would let the driver enumerate over keys in an ordinal manner?
Reply to this email directly or view it on GitHub:
https://github.com/s9tpepper/MongoAS3/pull/12/files#r652925
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.
It's fine, I share a bit of the frustration with creating command structures with this Document object. I have some ideas for alleviating some of that, I think I will add those when I merge your pull request. Its a good discussion to have though, if we can find a different solution around this Document object.
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'll try to give this some more thorough thought soon, probably tomorrow.
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.
also, i'm pretty new to github (this is my first pull request) -- it looks like the commit that removed that comment is automatically added to the pull request. can you confirm?
and, not sure if you want the method i added or not, up to you. i think you understand where my frustration came from tho -- if Document were just an Object getValueByKey would just be doc[key].
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.
one more thing -- after a quick look at the authentication concern you wrote above, i wonder: can't you just manually pull out the specific keys needed for authentication and push those into the ByteArray first? then, remove them from the object you're parsing into the ByteArray, and serialize the remainder of the document object in a non-determinate way (e.g. for-in).
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 would rather find a solution that worked across the board. I only found out about the ordinal expectation from MongoDB because the authentication commands were failing. I would assume there are other commands that require to be serialized in the correct key order.
Thanks a lot for the first Pull Request to MongoAS3 @ericsoco! This is quite a bit of changes so it'll take me a bit of time to go through them, will start on it this weekend. I'll likely bring it into an integration fork and write up some tests for the code you've added so I can bring it back in for a release. Awesome work! :D |
sorry omar.
Yep the commit with the comment is gone, this is also first time I'll be bringing code into one of my forks so it'll be fun. :) |
"and, not sure if you want the method i added or not, up to you. i think you understand where my frustration came from tho -- if Document were just an Object getValueByKey would just be doc[key]." In regards to this comment though, I totally get it. I have an idea, I'll play around with trying to have Document subclass flash.utils.Proxy and see if I can hijack the accessors to run keys used like doc[key] through the method you added to get a value. That might just work. |
- uints used for indexOf all changed to ints (-1 is not a valid uint value!) put() now checks for existing keys and overwrites remove() added toString() added <-- super useful for checking Document construction before sending to server! with the exception of toString, eliminating Document and using Objects instead would make all these changes unnecessary...
I was just looking at the ObjectId changes cause I was going to try to bring those changes in first so I can start getting these updates in, but I just noticed, and remembered, why I didn't translate this bit from the C# driver. I gotta set up a way to build a SWC for Flash and one for AIR. As the lib currently stands its agnostic so I've actually only used it in a couple of web browser projects. Adding references to NetworkInterface and NetworkInfo will make the lib AIR only, so I think I gotta add some conditional compilation stuff here or set up two builds of the lib with some other approach. |
yikes. totally didn't think about that as i'm only working with AIR. the ObjectID generation is relatively arbitrary -- doesn't really have to use computer specific information. that's really just to get as close as possible to uniqueness. you'll see my version is kinda half-assed too, as AIR can't get its own process ID (without launching a NativeProcess, i believe). i saw a javascript version of ObjectID on github but can't find it now...some googling turned up this: On Apr 17, 2012, at 12:23 PM, Omar Gonzalez wrote:
|
hi omar, have you made any progress on this? i've been derailed on other work since i made the pull request. |
so cool,looking forwad,come on omars! |
fyi, someone took the code i have in this pull request and rolled their own mongo AS3 driver: |
Hi Omar. Just checking if there's any progress on MongoAS3, or is it in the "no time" bucket for you? |
heavy edits to Wire.as to allow multiple synchronous requests (by using
multiple sockets); previously, multiple requests at the same time would
fail silently.
now that Wire manages multiple Socket instances (via RequestSequence),
DB.connect() is no longer necessary. just make requests directly.
error handlers are still piped back up via DB error Signals.
moved Wire away from dependency on Signals, though they're still used
throughout the rest of MongoAS3.
added new ObjectID generation (so inserts don't have to getLastError to
access an ObjectID generated by the server on a newly-inserted
document).
added timestamp extraction to ObjectID.
sorry about formatting differences from original MongoAS3.