Is there is something like stored procedures in NOSQL databases?
I am new to N开发者_C百科OSQL world and still comparing between nosql and sql databases,
I Just tried making few samples using mongodb.I am asking about stored procedures when we send few parameters to one stored procedure and this procedure execute number of other stored procedures in the database, will get data from stored procedures and send data to others.
In other words, will make the logic happen on the database side using sequence of functions and stored procedures.
Is that behavior or something the same already exist on NOSQL databases, or its completely different and i am thinking in the wrong way?
Mongo uses stored Javascript in a few places including Map/Reduce, db.eval and where clauses. Checkout this blog post for a survey:
Working With Stored JavaScript in MongoDB
The key to storing your functions on the server and making them available in these three contexts is db.system.js.save:
db.system.js.save( { _id : "foo" , value : function( x , y ){ return x + y; } } );
More details in the Mongo docs
Depends whether you define "NOSQL" as "No SQL" or "Not Only SQL."
OpenLink Virtuoso [1] (produced by my employer) is the latter, and has stored procedures, and SPARQL-in-SQL, and SQL-in-SPARQL, among other neat tricks; including extensibility via in-process runtime hosting (Perl, PHP, Python, Ruby, JSP, and others), external libraries or helper apps, and more.
Other NoSQL DBs have other ways of handling this, such as Mongo's extensibility via JavaScript, described in that other answer.
[1] http://virtuoso.openlinksw.com/
精彩评论