Link Search Menu Expand Document

IDField

Table of contents

  1. Example Usage

Field.ID is special field which is used to specify custom id for documents. If no id specify then id will be generated automatically.

Example Usage

const {Model, Field} = require("fireo");

class User extends Model{
    user_id = Field.ID();
}

const u = User.init();
u.user_id = "custom_doc_id";
await u.save();
// After save id will be saved in `user_id`
console.log(self.user_id)  // custom_doc_id

Copyright © 2019 FireO All rights reserved. Powered by OctaByte