MongoDB's "Stored procedure"

Source: Internet
Author: User

Use Db.system.js.insert ({_id: "AAA", Value: "Zzq"}); This command adds a global key-value pair to the global system JS with a _id of "AAA", Value "Zzq", and then uses it in the next turn.

Db.eval ("AAA"); The command shell can return zzq to me, and value can be an anonymous function, which is used like a JS global method (such as a stored procedure that simulates a relational database) such as: Db.system.js.insert ({_id:  "AAA", Value:function BB () {return 1;}); When using Db.eval ("AAA ()"); Yes the result returns 1;

MongoDB's "Stored procedure"

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.