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
  • Usage

Was this helpful?

Edit on Git
  1. Reference
  2. Fields

Link

PreviousIntegerNextLong

Last updated 6 years ago

Was this helpful?

A Link field type is provided to offer a way to store and retrieve well-formed URI (URL) while optionally restricting the allowable schemes, or protocols. Internally these values are stored as strings after normalization through the URI datatype, and on access provide that URI instance.

Import

from marrow.mongo.field import Link

Inherits

marrow.mongo.field:String

Attributes

This field type inherits all and represents a singular, scalar text value.

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 filtering operations, and access as an instance attribute will return a URI cast value.

Assignment of any value matched by the truthy iterable (via in comparison) will store True, and likewise with the falsy iterable storing False. Additionally, if an attempt is made to assign a non-boolean, non-string value, the value will be passed through bool() conversion prior to storage, allowing use of objects which define their own __nonzero__/__bool__ methods.

Field attributes