gstore-node
v8.x
v8.x
  • Introduction
  • Getting Started
    • Motivation
    • Installation
    • Create a gstore instance
  • Schema
    • About
    • Type validation
    • Value validation
    • Additional properties settings
    • Schema options
    • Joi Schema
    • Methods
      • path()
      • virtual()
    • Custom methods
  • Model
    • Creation
    • Methods
      • GET
      • UPDATE
      • DELETE
      • excludeFromIndexes()
      • key()
      • sanitize()
      • clearCache()
  • Entity
    • Creation
    • Properties
    • Methods
      • SAVE
      • plain()
      • populate()
      • model()
      • datastoreEntity()
      • validate()
  • Queries
    • @google-cloud Query
    • list()
    • findOne()
    • deleteAll()
    • findAround()
  • Populate
  • Middleware (hooks)
    • About
    • Pre hooks
    • Post hooks
  • Cache / Dataloader
    • Dataloader
    • Cache
  • gstore Methods
    • save()
  • Typescript
  • Appendix
    • Error Codes
    • Credits
Powered by GitBook
On this page

Was this helpful?

  1. Schema
  2. Methods

path()

Getter / Setter for schemas paths.

const mySchema = new Schema({ username: {type: String });

// Getter
mySchema.path('name'); // returns { type: String }

// Setter
mySchema.path('email', { type: String, validate: 'isEmail' });

// You can access the schema from a Model
const User = gstore.model('User');

// add new path to the User Schema
User.schema.path('age', { type: Number });
PreviousMethodsNextvirtual()

Last updated 6 years ago

Was this helpful?