How to use the mongoose.SchemaTypes.String function in mongoose

To help you get started, we’ve selected a few mongoose examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github usehenri / henri / packages / disk / types.js View on Github external
// Sequelize specific
  STRING: types.String,
  CHAR: types.String,
  TEXT: types.String,
  TINYINT: types.Number,
  SMALLINT: types.Number,
  MEDIUMINT: types.Number,
  INTEGER: types.Number,
  BIGINT: types.Number,
  NUMBER: types.Number,
  FLOAT: types.Number,
  DOUBLE: types.Number,
  DECIMAL: types.Number,
  REAL: types.Number,
  BOOLEAN: types.Boolean,
  BLOB: types.String,
  ENUM: types.Array,
  DATE: types.Date,
  DATEONLY: types.Date,
  TIME: types.Date,
  NOW: types.Date,
  UUID: types.ObjectId,
  UUIDV1: types.ObjectId,
  UUIDV4: types.ObjectId,
  HSTORE: types.Mixed,
  JSON: types.Mixed,
  JSONB: types.Mixed,
  ARRAY: types.Array,
  RANGE: types.mixed,
  GEOMETRY: types.Mixed,
  GEOGRAPHY: types.Mixed,
  VIRTUAL: types.Mixed,
github usehenri / henri / packages / disk / types.js View on Github external
String: types.String,
  Number: types.Number,
  Boolean: types.Boolean,
  DocumentArray: types.DocumentArray,
  Embedded: types.Embedded,
  Array: types.Array,
  Buffer: types.Buffer,
  Date: types.Date,
  ObjectId: types.ObjectId,
  Mixed: types.Mixed,
  Decimal128: types.Decimal128,
  Object: types.Mixed,
  Bool: types.Boolean,

  // Sequelize specific
  STRING: types.String,
  CHAR: types.String,
  TEXT: types.String,
  TINYINT: types.Number,
  SMALLINT: types.Number,
  MEDIUMINT: types.Number,
  INTEGER: types.Number,
  BIGINT: types.Number,
  NUMBER: types.Number,
  FLOAT: types.Number,
  DOUBLE: types.Number,
  DECIMAL: types.Number,
  REAL: types.Number,
  BOOLEAN: types.Boolean,
  BLOB: types.String,
  ENUM: types.Array,
  DATE: types.Date,
github vellengs / nestx / packages / servers / nestx-base / src / schemas / user.schema.ts View on Github external
import { Schema, Error, SchemaTypes as t } from 'mongoose';

import * as bcrypt from 'bcrypt';
import { ObjectID } from 'bson';

export const UserSchema = new Schema(
  {
    username: { type: t.String, minlength: 5, unique: true, required: true },
    password: t.String,
    avatar: t.String,
    email: { type: t.String, unique: true, required: false },
    name: t.String,
    about: t.String,
    location: {
      country: t.String,
      province: t.String,
      district: t.String,
      address: t.String,
    },
    type: t.String,
    mobile: { type: t.String, unique: true, required: true },
    roles: [
      {
        type: t.ObjectId,
        ref: 'Role',
      },
    ],
    groups: [
      {
github vellengs / typerx / packages / server / src / modules / core / schemas / menu.schema.ts View on Github external
import { Schema, SchemaTypes as t, SchemaOptions, model } from 'mongoose';

export const schema = new Schema({
	name: { type: t.String },
	slug: { type: t.String },
	group: { type: t.Boolean },
	link: { type: t.String },
	externalLink: { type: t.String },
	blank: { type: t.Boolean },
	icon: { type: t.String },
	order: { type: t.Number, default: 100 },
	enable: { type: t.Boolean },
	expanded: { type: t.Boolean },
	acl: { type: t.String },
	paths: [{
		type: t.ObjectId,
		ref: 'Menu'
	}],
	parent: {
		type: t.ObjectId,
github vellengs / typerx / packages / server / src / modules / core / schemas / account.schema.ts View on Github external
Schema,
  SchemaTypes as t,
  Error,
  SchemaOptions,
  model,
} from 'mongoose';
import * as bcrypt from 'bcrypt-nodejs';
import * as crypto from 'crypto';

export const schema = new Schema(
  {
    username: { type: t.String, required: true, unique: true },
    password: {
      type: t.String, required: true,
    },
    avatar: t.String,
    keyword: t.String,
    email: t.String,
    name: t.String,
    type: t.String,
    mobile: t.String,
    roles: [
      {
        type: t.ObjectId,
        ref: 'Role',
      },
    ],
    groups: [
      {
        type: t.ObjectId,
        ref: 'Group',
      },
github vellengs / typerx / packages / server / src / modules / cms / schemas / article.schema.ts View on Github external
import { Schema, SchemaTypes as t, SchemaOptions, model } from 'mongoose';

export const schema = new Schema({
    name: { type: t.String },
    title: t.String,
    keyword: t.String,
    picture: t.String,
    description: t.String,
    author: t.String,
    sort: t.Number,
    disable: t.Boolean,
    category: {
        ref: 'Category', type: t.ObjectId
    },
    meta: {
        ref: 'Meta', type: t.ObjectId
    },
    content: {
        ref: 'Content', type: t.ObjectId,
    },
github vellengs / nestx-server / packages / base / src / schemas / group.schema.ts View on Github external
import { Schema, SchemaTypes as t } from "mongoose";
import { utils } from "nestx-common";
const { transform } = utils;

export const GroupSchema = new Schema(
  {
    outid: { type: t.Number },
    name: { type: t.String },
    icon: { type: t.String },
    isRegion: { type: t.Boolean },
    order: { type: t.Number },
    parent: { type: t.ObjectId, ref: "Group" },
    paths: [{ type: t.ObjectId, ref: "Group" }],
    director: { type: t.ObjectId, ref: "User" },
    description: { type: t.String }
  },
  { timestamps: true }
);

GroupSchema.set("toJSON", {
  transform
});
github vellengs / nestx-server / packages / base / src / schemas / setting.schema.ts View on Github external
export const SettingSchema = new Schema(
  {
    id: {
      type: t.String,
    },
    name: {
      type: t.String,
    },
    key: {
      type: t.String,
    },
    value: {
      type: t.Mixed,
    },
    description: {
      type: t.String,
    },
  },
  {
    timestamps: true,
    usePushEach: true,
  },
);

SettingSchema.set('toJSON', {
  transform,
});
github vellengs / nestx / packages / servers / nestx-base / src / schemas / setting.schema.ts View on Github external
import { Schema, SchemaTypes as t } from 'mongoose';
import { utils } from "nestx-common";
const { transform } = utils;

export const SettingSchema = new Schema(
  {
    id: {
      type: t.String,
    },
    name: {
      type: t.String,
    },
    key: {
      type: t.String,
    },
    value: {
      type: t.Mixed,
    },
    description: {
      type: t.String,
    },
  },
  {
    timestamps: true,
github vellengs / nestx / src / server / core / schemas / user.schema.ts View on Github external
import { Schema, SchemaTypes as t, SchemaOptions } from 'mongoose';
const option: SchemaOptions = {};
option.timestamps = true;

export const schema = new Schema({
    username: t.String,
    password: t.String,
    avatar: t.String,
    email: t.String,
    nick: t.String,
    type: t.String,
    mobile: t.String,
    roles: [{
        type: t.ObjectId, ref: 'Role'
    }],
    isDisable: {
        type: t.Boolean
    },
    isAdmin: {
        type: t.Boolean
    },
    isApproved: {
        type: t.Boolean
    },
    expired: {
        type: t.Boolean