The Marrow Mongo Document Mapper
  • Introduction
  • Installation
  • Contributing
  • Guide
    • Introduction
    • Modelling
    • Management
    • Interaction
    • Fields
    • Indexes
    • Trait Mix-Ins
    • Plugin Namespaces
  • Reference
    • Decimal
    • Field
    • Index
    • Fields
      • Alias
      • Array
      • Binary
      • Boolean
      • Date
      • Double
      • Embed
      • Integer
      • Link
      • Long
      • Mapping
      • Markdown
      • Number
      • ObjectId
      • Path
      • Period
      • Plugin
      • Reference
      • Regex
      • Set
      • String
      • TTL
      • Timestamp
    • Parametric
      • F (Filter)
      • P (Project)
      • S (Sort)
      • U (Update)
    • Query
      • Ops
      • Q
    • Traits
      • Collection
      • Derived
      • Expires
      • Heirarchical
      • Identified
      • Localized
      • Lockable
      • Published
      • Stateful
      • Queryable
    • Utilities
      • Capped Collections
      • Geospatial
      • Logging
  • End Matter
    • Colophon
    • License
    • History
Powered by GitBook
On this page
  • Import
  • Inherits
  • Attributes
  • strip
  • case
  • Usage
  • See Also

Was this helpful?

Edit on Git
  1. Reference
  2. Fields

String

PreviousSetNextTTL

Last updated 6 years ago

Was this helpful?

String fields store Unicode text, utilizing the native Unicode representation for your version of Python. (On Python 2: unicode, on Python 3: str.)

Import

from marrow.mongo.field import String

Inherits

marrow.mongo:Field

Attributes

This field type inherits all and represents a singular, scalar Unicode string value. In addition to the basic attributes, String fields can automatically strip extraneous whitespace on assignment or perform case normalization, e.g. automatic execution of str.upper(), str.lower(), or str.title().

strip

Either the boolean literal True or a string representing the argument to str.strip, that is, the characters to strip.

DefaultFalse

Added>=1.1.1

case

Truthy values (or the string literal "u" or "upper") will request uppercase normalization, falsy values (or the literals "l" or "lower") request lowercase normalization, or the literal "title" can be used to request title case.

DefaultNone

Added>=1.1.1

Usage

Instantiate and assign an instance of this class during construction of a new Document subclass. Accessing as a class attribute will return a Queryable allowing string filtering operations, and access as an instance attribute will return a str (or unicode on Python 2) cast value.

See Also

Field attributes
Binary