Hi Charles,

Could you please provide some example code? I'm looking at doing something 
similar and I cannot find any documentation on how to code a hook in 
javascript.
Your help would be much appreciated.

Miguel

Le mardi 11 août 2015 06:02:22 UTC-4, Charles Munat a écrit :
>
> I did that and managed to get it working. A slug is used in a URL to 
> identify a resource, usually by "traincasing" its name, e.g., 
> /cool-blog-post-2015-07-31. It makes for a better, more aesthetic, and 
> human-readable URL compared to using UUIDs.
>
> Chas.
>
> On Tuesday, August 11, 2015 at 5:59:07 AM UTC+12, David Carr wrote:
>>
>> I'm not familiar with the term slug but you should be able to do this via 
>> a hook (aka insert trigger). I have a few insert triggers that work well. 
>> Try to follow the tutorial here 
>> http://orientdb.com/docs/last/Tutorial-Java-Hooks.html.
>>
>> On Sunday, August 9, 2015 at 3:27:13 AM UTC-6, Charles Munat wrote:
>>>
>>> I want to create a slug from a user's name and save it when the record 
>>> is created. In PostgreSQL this is easy with a procedure and a trigger, but 
>>> I can't for the life of me figure out how to do it in OrientDB. I need to 
>>> a) get hold of the name field of the document within the javascript 
>>> function onBeforeCreate, and b) I need to compare the slug to all the other 
>>> slugs to ensure that it is unqiue, and to add an incremented integer if it 
>>> is not.
>>>
>>> It would be nice to have a simple function that I could call on default 
>>> for the slug field (better still if I could pass it the name of the field 
>>> or fields to be used to create the slug). Barring that, a dynamic hook.
>>>
>>> What is the best practice, or can someone provide a link to where this 
>>> is covered in the documentation? I can't find it.
>>>
>>> TIA,
>>>
>>> Chas. Munat
>>>
>>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to