feat(decorators): support registering arg by `createParameterDecorator`
This PR is aiming to solve #1325. It's based on #1330 PR by @russell-dot-js 🙌 Unfortunately, after #1400 that PR contained a lot of conflicts, and I was unable to push a commit with fixes into the upstream repo.
There are some differences between this PR and #1330.
Mainly, the signature of the createParamDecorator has been simplified and now arg options are the second argument of this function.
It also renames createParamDecorator to createParameterDecorator (v2 can have breaking changes).
The returnTypeFunc key has been changed to typeFunc as we describe the input type (I still need to adjust other decorators' signature).
Additionally, docs has been updated to reflect the new feature, so do the examples.
And there's now an entry to changelog about this.
I looked at porting mongoose to RethinkDB, and eventually didn't do it.
I think it didn't look that hard, but the API wasn't as nice as using ReQL. So in the end I wrote thinky (https://github.com/neumino/thinky -- I have to update it though).
I still think that making mongoose work for RethinkDB would be useful, and I would be happy to help you. I'll be more or less traveling by plane/boat/horse for the next few days, but I should be able to answer any question you have.
Hi, @Siyfion -- for the time being we can't quite schedule this yet, but if you're willing to do the port, we'd love to help you with any information you need. What can we do to help?
Might sound like a dumb question, but has anyone actually spoken to the Mongoose devs to get their opinion on this idea? @aheckmann being the main person to talk too...? Is it possible that the "real" Mongoose project could be updated to include support for MongoDB & RethinkDB?
I don't think so, but I'll reach out and report my findings (unless @aheckmann notices this first).
the general concept of using mongoose with other mongodb drivers was a design goal. it falls a little short but much of the design is there already, albeit undocumented.
as for making mongoose compatible with a different database altogether, well that would take a lot more work. not against it really, but not in favor either since it opens the door to even more dbs and more complexity which i'm not a fan of. I think one reason mongoose has been successful is its core focus on a single database and optimizing for it alone. this lowers implementation complexity and maximizes the small amount of time we have to work on the project.
@aheckmann -- that makes sense (less and more and all). Do you think it's a worthwhile idea to fork Mongoose for a RethinkDB port or would it be better to write a mapper from scratch? I'm curious what your thoughts are (since I don't know how Mongoose internals are structured beyond a surface understanding).
I'd probably start from scratch being that mongoose needs to start from scratch anyway due to too much logic contained internally which should really exist in separate stand-alone modules. If you went this way I'd love to be involved and provide feedback since ideally we could reuse some of these components between projects and have both projects win. Kind of building that higher level abstraction I don't want but without necessitating including the code specific to Rethink and the Rethink project not including the MongoDB parts. Worth a shot I'd say. No idea how Rethink or MongoDB feel about it though :)
On Thursday, December 19, 2013, coffeemug wrote:
@aheckmann https://github.com/aheckmann -- that makes sense (less and more and all). Do you think it's a worthwhile idea to fork Mongoose for a RethinkDB port or would it be better to write a mapper from scratch? I'm curious what your thoughts are (since I don't know how Mongoose internals are structured beyond a surface understanding).
— Reply to this email directly or view it on GitHubhttps://github.com/rethinkdb/rethinkdb/issues/1782#issuecomment-30919036 .
Aaron @aaronheckmann https://twitter.com/#!/aaronheckmann soundcloud.com/ajhecky github.com/aheckmann
I've begun something like that: https://github.com/artiifix/rethought It's a simple ES6 class using generators, so little code but still quite powerful.