Skip to content

Conversation

@christophstrobl
Copy link
Member

We added ScriptOperations to MongoTemplate. Those allow storage and execution of javascript function directly on the MongoDB server instance. Having ScriptOperations in place builds the foundation for annotation driver support in repository layer.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed - thanks @thomasdarimont !

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why Serializable? For supporting String and ObjectIds?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Yes, would have been for calling scripts via ObjectId, but once I tried to do so it turned out that one can store the script using ObjectId but won't be able to call it later as the name needs to be a String. Should be String instead of Serializable then.

@christophstrobl christophstrobl force-pushed the issue/DATAMONGO-479 branch 2 times, most recently from ff494b7 to c7db98b Compare January 8, 2015 11:41
We added ScriptOperations to MongoTemplate. Those allow storage and execution of java script function directly on the MongoDB server instance. Having ScriptOperations in place builds the foundation for annotation driver support in repository layer.
Fix broken tests by avoiding initialization of MongoRepositories on package as this would trigger index creation which is likely to fail on older server versions.
Use more explicit wording and add methods for checking existence of functions via name as well as listing names of available scripts. Updated javaDoc and reference documentation.
Use getCode() instead of toString for converting o.b.t.Code objects. This works fine for MongoDB Java driver versions 2 and 3.
christophstrobl added a commit that referenced this pull request Mar 4, 2015
We added ScriptOperations to MongoTemplate. Those allow storage and execution of java script function directly on the MongoDB server instance. Having ScriptOperations in place builds the foundation for annotation driver support in repository layer.

Original pull request: #254.
odrotbohm added a commit that referenced this pull request Mar 4, 2015
Removed ServersideJavaScript abstraction as we still had to resort on instanceof checks and it created more ambiguities than it helped (e.g. in a script with name and code, which of the two get's executed?). We now have an ExecutableMongoScript which is code only and a NamedMongoScript, which basically is the former assigned to a name. Execution can be triggered on the former or a name.

ScriptOperations.exists(…) now returns a primitive boolean to avoid null checks. JavaDoc.

Original pull request: #254.
@odrotbohm odrotbohm closed this Mar 4, 2015
@odrotbohm odrotbohm deleted the issue/DATAMONGO-479 branch March 4, 2015 14:20
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

Successfully merging this pull request may close these issues.

4 participants