Server-side Code Execution

68 views
Skip to first unread message

Ethan Gunderson

unread,
Oct 11, 2010, 7:17:23 PM10/11/10
to mongodb-user
This is more of a curiosity question than anything, but what are you guys using Server-Side code execution for? And by that, I mean in the context of:

db.myCollection.find( { $where: "this.a > 3" });

It makes a lot of sense that, behind the scenes, this is what the query operators are using, but other than that, what are you using this feature for? Was this designed to solve a specific problem, or is it just a byproduct of implementing query operators?

--
Ethan

http://www.mongodb.org/display/DOCS/Server-side+Code+Execution

Markus Gattol

unread,
Oct 11, 2010, 7:34:57 PM10/11/10
to mongodb-user
> Was this designed to solve a specific problem, or is
> it just a byproduct of implementing query operators?

I would say neither. Semantically it's the same as stored
procedures ... more or less.

Eliot Horowitz

unread,
Oct 11, 2010, 7:40:20 PM10/11/10
to mongod...@googlegroups.com

Actually that's not used internally at all since it's slower than the query operator

Also, it's designed exactly not to solve a specific problem but a general one. 
Its basically meant to fill gaps in the query language since it's still evolving
--
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com.
To unsubscribe from this group, send email to mongodb-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.

Scott Hernandez

unread,
Oct 11, 2010, 7:59:13 PM10/11/10
to mongod...@googlegroups.com
I would argue this is very little like a stored procedure and
shouldn't be treated as such (or thought of that way). Stored
procedures don't have the byproduct they are single threaded (across
the server, like javascript is). Stored procedures aren't executed on
a single row (that is usually called a user-function), but more like a
full query which returns values (rows).

Ethan Gunderson

unread,
Oct 11, 2010, 8:00:37 PM10/11/10
to mongod...@googlegroups.com
Thanks Eliot, that makes sense. Guess that's what I get for jumping the gun and assuming query operators used it.
Reply all
Reply to author
Forward
0 new messages