[SERVER-82] Allow loading of persistent JavaScript functions Created: 31/May/09  Updated: 15/Aug/09  Resolved: 20/Jul/09

Status: Closed
Project: Core Server
Component/s: JavaScript
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Jon Crosby Assignee: Eliot Horowitz (Inactive)
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Any


Participants:

 Description   

I would like the ability to reuse non-trivial JavaScript functions across multiple queries. For example, I would like to do something like "db.require" where x is the contents of a JavaScript library. Future queries would have access to any functions defined the given library. This scope could be maintained at the collection or database level. Either or both would be useful.



 Comments   
Comment by Eliot Horowitz (Inactive) [ 15/Aug/09 ]

closed since resolved 2+ weeks ago

Comment by Eliot Horowitz (Inactive) [ 20/Jul/09 ]

see SERVER-157

Comment by sandstrom [ 20/Jul/09 ]

Perhaps related: http://jira.mongodb.org/browse/SERVER-157

Comment by sandstrom [ 08/Jul/09 ]

Not sure if this is what you are asking for, but this may already be available. Although I don't know if it's possible to add files, or if the script has to be passed as an argument.

mongo --help
usage: /usr/local/mongodb/bin/mongo [options] [db address] [file names]
db address can be:
foo = foo database on local machine
192.169.0.5/foo = foo database on 192.168.0.5 machine
192.169.0.5:9999/foo = foo database on 192.168.0.5 machine on port 9999
options
--shell run the shell after executing files
-u <username>
-p<password> - notice no space
--host <host> - server to connect to
--port <port> - port to connect to
--nodb don't connect to mongo program on startup. No 'db address' arg expected.
--eval <script> evaluate javascript.
file names: a list of files to run. will exit after unless --shell is specified

Generated at Thu Feb 08 02:52:58 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.