GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Mongoose::Role::Naming(3) User Contributed Perl Documentation Mongoose::Role::Naming(3)

Mongoose::Role::Naming

This role implement class to collection name methods for Mongoose objects.

By default will compose the MongoDB collection name from your package name by replacing double-colon "::" with underscores "_", separating camel-case, such as "aB" with "a_b" and uppercase with lowercase letters.

This behaviour can be changed by choosing a named method or by setting the collection naming routine with a "closure".

This are the available named methods:

     named method | package name          | collection
    --------------+-----------------------+-----------------------
     short        | MyApp::Schema::FooBar | foobar
     plural       | MyApp::Schema::FooBar | foobars
     decamel      | MyApp::Schema::FooBar | foo_bar
     lower        | MyApp::Schema::FooBar | myapp::schema::foobar
     upper        | MyApp::Schema::FooBar | MYAPP::SCHEMA::FOOBAR
     undercolon   | MyApp::Schema::FooBar | myapp_schema_foobar
     default      | MyApp::Schema::FooBar | myapp_schema_foo_bar
     none         | MyApp::Schema::FooBar | MyApp::Schema::FooBar

You can choose a predefined naming method

    Mongoose->naming( 'plural' );

... or combine them

    Mongoose->naming( ['decamel','plural' ] );  # same as 'shorties'

If you set a closure it will receive the package name as it only parameter and should return the collection name.

    # plain lowercase
    Mongoose->naming( sub { lc(shift) } );
2018-10-08 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.