Voyage by default provides this: voyageCollectionName "This method can be overridden with a more meaningful collection name" ^ ((self persistentClass name first: 3) allSatisfy: #isUppercase) ifTrue: [ (self persistentClass name allButFirst: 2) asLegalSelector ] ifFalse: [ self persistentClass name asLegalSelector ] So a class name like Association will end up in a mongo collection like "association". But a class name with a prefix like "PDFLetter" will end up in a mongo collection name like "fLetter". Is there a reason for this specific default behavior and not having the class name (by default) as the collection name in mongo? I know I can override the method - but I wonder why it is treated specially also leading to potential conflicts: PDFLetter voyageCollectionName -> #fLetter FLetter voyageCollectionName -> #fLetter Thx T.
Hi Torsten. May not be the case, but I've seen do that elsewhere (in Pier I think) and the reason is simply remove (sanitize) the namespace of the class (the first two letters in uppercase). Best. 2014-07-09 17:12 GMT-03:00 Torsten Bergmann <astares@gmx.de>:
Voyage by default provides this:
voyageCollectionName "This method can be overridden with a more meaningful collection name" ^ ((self persistentClass name first: 3) allSatisfy: #isUppercase) ifTrue: [ (self persistentClass name allButFirst: 2) asLegalSelector ] ifFalse: [ self persistentClass name asLegalSelector ]
So a class name like Association will end up in a mongo collection like "association".
But a class name with a prefix like "PDFLetter" will end up in a mongo collection name like "fLetter".
Is there a reason for this specific default behavior and not having the class name (by default) as the collection name in mongo? I know I can override the method - but I wonder why it is treated specially also leading to potential conflicts:
PDFLetter voyageCollectionName -> #fLetter FLetter voyageCollectionName -> #fLetter
Thx T.
you also can change the collection name without overriding the method, you just need to declare a <mongoContainer> method: MyClass class>>#mongoContainer <mongoContainer> ^ VOMongoContainer new collectionName: âmynameâ; yourself the purpose of the method is, as Gaston says, just to sanitize the name (and yes, I just copied the pier implementation). cheers, Esteban On 11 Jul 2014, at 15:43, Gastón Dall' Oglio <gaston.dalloglio@gmail.com> wrote:
Hi Torsten.
May not be the case, but I've seen do that elsewhere (in Pier I think) and the reason is simply remove (sanitize) the namespace of the class (the first two letters in uppercase).
Best.
2014-07-09 17:12 GMT-03:00 Torsten Bergmann <astares@gmx.de>: Voyage by default provides this:
voyageCollectionName "This method can be overridden with a more meaningful collection name" ^ ((self persistentClass name first: 3) allSatisfy: #isUppercase) ifTrue: [ (self persistentClass name allButFirst: 2) asLegalSelector ] ifFalse: [ self persistentClass name asLegalSelector ]
So a class name like Association will end up in a mongo collection like "association".
But a class name with a prefix like "PDFLetter" will end up in a mongo collection name like "fLetter".
Is there a reason for this specific default behavior and not having the class name (by default) as the collection name in mongo? I know I can override the method - but I wonder why it is treated specially also leading to potential conflicts:
PDFLetter voyageCollectionName -> #fLetter FLetter voyageCollectionName -> #fLetter
Thx T.
participants (3)
-
Esteban Lorenzano -
Gastón Dall' Oglio -
Torsten Bergmann