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

Add option to use raw MongoDB queries in the query string #35

Open
macalinao opened this issue Jul 18, 2014 · 2 comments
Open

Add option to use raw MongoDB queries in the query string #35

macalinao opened this issue Jul 18, 2014 · 2 comments

Comments

@macalinao
Copy link

Something like this:

/api/user?query={"$and":[{"field":"~value"},{"field":"!=value"}]}

I'd like to be able to write my logic mainly on the client, rather than dealing with finders. Is this a feature you are willing to add?

@jspears
Copy link
Owner

jspears commented Jul 18, 2014

I am afraid to do this for the security implications... However I have
begun implementing a JS language extension using Sweet.js to allow for
mongoose calls to be made from the client... It would compile a server
side component and client side transparently.

//client code;

var @user = new @mongoose.model('User');
var localVar = 'stuff', user;

$('input[type="name"]').on('click', function(){
//this would be wrapped in a rest call.
@user.findById(localVar).exec(function(e,o){
$('#update').text(user.name);
});
});

Let me know if you have any thoughts.

On Fri, Jul 18, 2014 at 1:19 PM, Ian Macalinao notifications@github.com
wrote:

Something like this:

/api/user?query={"$and":[{"field":"~value"},{"field":"!=value"}]}

I'd like to be able to write my logic mainly on the client, rather than
dealing with finders. Is this a feature you are willing to consider?


Reply to this email directly or view it on GitHub
#35.

@macalinao
Copy link
Author

That sounds really cool, I would be interested in that. (Actually, that's why I want to allow raw queries in the first place)

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