diff --git a/404.html b/404.html index be447629..0808756e 100644 --- a/404.html +++ b/404.html @@ -4,13 +4,13 @@ Page Not Found | Ottoman.js - - + +
-
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

- - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

+ + \ No newline at end of file diff --git a/assets/js/0176426c.6cd28f2c.js b/assets/js/0176426c.7421d4df.js similarity index 96% rename from assets/js/0176426c.6cd28f2c.js rename to assets/js/0176426c.7421d4df.js index 2f47aa04..37b1aefa 100644 --- a/assets/js/0176426c.6cd28f2c.js +++ b/assets/js/0176426c.7421d4df.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[2881],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=o(a),k=r,u=c["".concat(d,".").concat(k)]||c[k]||m[k]||i;return a?n.createElement(u,l(l({ref:t},s),{},{components:a})):n.createElement(u,l({ref:t},s))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=c;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"EmbedType",title:"Class: EmbedType",sidebar_label:"EmbedType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/EmbedType",id:"api/classes/EmbedType",title:"Class: EmbedType",description:"EmbedType will allow declaration of path as another schema, set type to the sub-schema's instance.",source:"@site/docs/api/classes/EmbedType.md",sourceDirName:"api/classes",slug:"/api/classes/EmbedType",permalink:"/docs/api/classes/EmbedType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"EmbedType",title:"Class: EmbedType",sidebar_label:"EmbedType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Document",permalink:"/docs/api/classes/Document"},next:{title:"FindByIdOptions",permalink:"/docs/api/classes/FindByIdOptions"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"schema",id:"schema",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-15",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"EmbedType")," will allow declaration of path as another schema, set type to the sub-schema's instance."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const userSchema = new Schema({\n name: String,\n email: Schema.Types.String,\n createAt: Date,\n});\n\nconst schema = new Schema({\n ...\n user: userSchema\n});\n")),(0,r.kt)("p",null,"You can also use a JavaScript plain Object as value for an ",(0,r.kt)("inlineCode",{parentName:"p"},"EmbedType"),".\nTherefore the below example will behave the same as the example above."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const schema = new Schema({\n ...\n user: {\n name: String,\n email: String,\n createAt: Date,\n }\n});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Tip"))),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"EmbedType")," will allow you to easily reuse existing schemas into new ones using composition."),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"EmbedType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new EmbedType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema")))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/embed-type.ts#L49"},"schema/types/embed-type.ts:49")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"schema"},"schema"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"schema"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/embed-type.ts#L49"},"schema/types/embed-type.ts:49")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"'Embed'")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/embed-type.ts#L52"},"schema/types/embed-type.ts:52")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/embed-type.ts#L54"},"schema/types/embed-type.ts:54")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/embed-type.ts#L62"},"schema/types/embed-type.ts:62")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[2881],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=o(a),k=r,u=c["".concat(d,".").concat(k)]||c[k]||m[k]||i;return a?n.createElement(u,l(l({ref:t},s),{},{components:a})):n.createElement(u,l({ref:t},s))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=c;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"EmbedType",title:"Class: EmbedType",sidebar_label:"EmbedType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/EmbedType",id:"api/classes/EmbedType",title:"Class: EmbedType",description:"EmbedType will allow declaration of path as another schema, set type to the sub-schema's instance.",source:"@site/docs/api/classes/EmbedType.md",sourceDirName:"api/classes",slug:"/api/classes/EmbedType",permalink:"/docs/api/classes/EmbedType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"EmbedType",title:"Class: EmbedType",sidebar_label:"EmbedType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Document",permalink:"/docs/api/classes/Document"},next:{title:"FindByIdOptions",permalink:"/docs/api/classes/FindByIdOptions"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"schema",id:"schema",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-15",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"EmbedType")," will allow declaration of path as another schema, set type to the sub-schema's instance."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const userSchema = new Schema({\n name: String,\n email: Schema.Types.String,\n createAt: Date,\n});\n\nconst schema = new Schema({\n ...\n user: userSchema\n});\n")),(0,r.kt)("p",null,"You can also use a JavaScript plain Object as value for an ",(0,r.kt)("inlineCode",{parentName:"p"},"EmbedType"),".\nTherefore the below example will behave the same as the example above."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const schema = new Schema({\n ...\n user: {\n name: String,\n email: String,\n createAt: Date,\n }\n});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Tip"))),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"EmbedType")," will allow you to easily reuse existing schemas into new ones using composition."),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"EmbedType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new EmbedType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema")))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/embed-type.ts#L49"},"schema/types/embed-type.ts:49")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"schema"},"schema"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"schema"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/embed-type.ts#L49"},"schema/types/embed-type.ts:49")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"'Embed'")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/embed-type.ts#L52"},"schema/types/embed-type.ts:52")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/embed-type.ts#L54"},"schema/types/embed-type.ts:54")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/embed-type.ts#L62"},"schema/types/embed-type.ts:62")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/12f9af5b.7676f3cf.js b/assets/js/12f9af5b.29129cf1.js similarity index 98% rename from assets/js/12f9af5b.7676f3cf.js rename to assets/js/12f9af5b.29129cf1.js index a6015496..dda84aed 100644 --- a/assets/js/12f9af5b.7676f3cf.js +++ b/assets/js/12f9af5b.29129cf1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9955],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),d=s(r),y=a,m=d["".concat(p,".").concat(y)]||d[y]||u[y]||i;return r?n.createElement(m,l(l({ref:t},c),{},{components:r})):n.createElement(m,l({ref:t},c))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>s});var n=r(7462),a=(r(7294),r(3905));const i={id:"MultipleQueryTypesException",title:"Class: MultipleQueryTypesException",sidebar_label:"MultipleQueryTypesException",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/classes/MultipleQueryTypesException",id:"api/classes/MultipleQueryTypesException",title:"Class: MultipleQueryTypesException",description:"Hierarchy",source:"@site/docs/api/classes/MultipleQueryTypesException.md",sourceDirName:"api/classes",slug:"/api/classes/MultipleQueryTypesException",permalink:"/docs/api/classes/MultipleQueryTypesException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"MultipleQueryTypesException",title:"Class: MultipleQueryTypesException",sidebar_label:"MultipleQueryTypesException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Model",permalink:"/docs/api/classes/Model"},next:{title:"NumberType",permalink:"/docs/api/classes/NumberType"}},p={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],c={toc:s};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"MultipleQueryTypesException"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new MultipleQueryTypesException"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"type1"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"type2"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"type1")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"type2")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"))))),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/exceptions.ts#L25"},"query/exceptions.ts:25")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9955],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>y});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function l(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var p=n.createContext({}),s=function(e){var t=n.useContext(p),r=t;return e&&(r="function"==typeof e?e(t):l(l({},t),e)),r},c=function(e){var t=s(e.components);return n.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),d=s(r),y=a,m=d["".concat(p,".").concat(y)]||d[y]||u[y]||i;return r?n.createElement(m,l(l({ref:t},c),{},{components:r})):n.createElement(m,l({ref:t},c))}));function y(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,l=new Array(i);l[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var s=2;s{r.r(t),r.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>i,metadata:()=>o,toc:()=>s});var n=r(7462),a=(r(7294),r(3905));const i={id:"MultipleQueryTypesException",title:"Class: MultipleQueryTypesException",sidebar_label:"MultipleQueryTypesException",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/classes/MultipleQueryTypesException",id:"api/classes/MultipleQueryTypesException",title:"Class: MultipleQueryTypesException",description:"Hierarchy",source:"@site/docs/api/classes/MultipleQueryTypesException.md",sourceDirName:"api/classes",slug:"/api/classes/MultipleQueryTypesException",permalink:"/docs/api/classes/MultipleQueryTypesException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"MultipleQueryTypesException",title:"Class: MultipleQueryTypesException",sidebar_label:"MultipleQueryTypesException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Model",permalink:"/docs/api/classes/Model"},next:{title:"NumberType",permalink:"/docs/api/classes/NumberType"}},p={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],c={toc:s};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"MultipleQueryTypesException"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new MultipleQueryTypesException"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"type1"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"type2"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"type1")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"type2")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"))))),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/exceptions.ts#L25"},"query/exceptions.ts:25")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/177b2302.e1400b03.js b/assets/js/177b2302.514b3b1f.js similarity index 92% rename from assets/js/177b2302.e1400b03.js rename to assets/js/177b2302.514b3b1f.js index f58a65d7..0b1f7309 100644 --- a/assets/js/177b2302.e1400b03.js +++ b/assets/js/177b2302.514b3b1f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5707],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(n),m=i,h=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return n?r.createElement(h,a(a({ref:t},u),{},{components:n})):r.createElement(h,a({ref:t},u))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var r=n(7462),i=(n(7294),n(3905));const o={id:"SearchConsistency",title:"Enumeration: SearchConsistency",sidebar_label:"SearchConsistency",sidebar_position:0,custom_edit_url:null},a=void 0,s={unversionedId:"api/enums/SearchConsistency",id:"api/enums/SearchConsistency",title:"Enumeration: SearchConsistency",description:"Enumeration Members",source:"@site/docs/api/enums/SearchConsistency.md",sourceDirName:"api/enums",slug:"/api/enums/SearchConsistency",permalink:"/docs/api/enums/SearchConsistency",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"SearchConsistency",title:"Enumeration: SearchConsistency",sidebar_label:"SearchConsistency",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Exports",permalink:"/docs/api/modules"},next:{title:"VALIDATION_STRATEGY",permalink:"/docs/api/enums/VALIDATION_STRATEGY"}},l={},c=[{value:"Enumeration Members",id:"enumeration-members",level:2},{value:"GLOBAL",id:"global",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"LOCAL",id:"local",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"NONE",id:"none",level:3},{value:"Defined in",id:"defined-in-2",level:4}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h2",{id:"enumeration-members"},"Enumeration Members"),(0,i.kt)("h3",{id:"global"},"GLOBAL"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"GLOBAL")," = ",(0,i.kt)("inlineCode",{parentName:"p"},"2")),(0,i.kt)("p",null,"Operations performed by any client of the Couchbase Server up to the\ntime of the queries dispatch will be reflected in any index results.\nThis is the slowest of all consistency levels as it requires that the\nserver synchronize its indexes to the current key-value state prior to\nexecution of the query.\nCalled as REQUEST_PLUST in Couchbase Server"),(0,i.kt)("h4",{id:"defined-in"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/search-consistency.ts#L26"},"utils/search-consistency.ts:26")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"local"},"LOCAL"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"LOCAL")," = ",(0,i.kt)("inlineCode",{parentName:"p"},"1")),(0,i.kt)("p",null,"Operations performed by this ottoman instance will be reflected\nin queries performed by this particular ottoman instance. This\ntype of consistency will be slower than no consistency, but faster\nthan GLOBAL as the index state is tracked internally rather than\nrequested from the server.\nCalled as AT_PLUS in Couchbase Server"),(0,i.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/search-consistency.ts#L16"},"utils/search-consistency.ts:16")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"none"},"NONE"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"NONE")," = ",(0,i.kt)("inlineCode",{parentName:"p"},"0")),(0,i.kt)("p",null,"No degree consistency required.\nCalled as NOT_BOUNDED in Couchbase Server."),(0,i.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/search-consistency.ts#L6"},"utils/search-consistency.ts:6")))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5707],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},u=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(n),m=i,f=d["".concat(l,".").concat(m)]||d[m]||p[m]||o;return n?r.createElement(f,a(a({ref:t},u),{},{components:n})):r.createElement(f,a({ref:t},u))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,a[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>p,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var r=n(7462),i=(n(7294),n(3905));const o={id:"SearchConsistency",title:"Enumeration: SearchConsistency",sidebar_label:"SearchConsistency",sidebar_position:0,custom_edit_url:null},a=void 0,s={unversionedId:"api/enums/SearchConsistency",id:"api/enums/SearchConsistency",title:"Enumeration: SearchConsistency",description:"Enumeration Members",source:"@site/docs/api/enums/SearchConsistency.md",sourceDirName:"api/enums",slug:"/api/enums/SearchConsistency",permalink:"/docs/api/enums/SearchConsistency",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"SearchConsistency",title:"Enumeration: SearchConsistency",sidebar_label:"SearchConsistency",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Exports",permalink:"/docs/api/modules"},next:{title:"VALIDATION_STRATEGY",permalink:"/docs/api/enums/VALIDATION_STRATEGY"}},l={},c=[{value:"Enumeration Members",id:"enumeration-members",level:2},{value:"GLOBAL",id:"global",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"LOCAL",id:"local",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"NONE",id:"none",level:3},{value:"Defined in",id:"defined-in-2",level:4}],u={toc:c};function p(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h2",{id:"enumeration-members"},"Enumeration Members"),(0,i.kt)("h3",{id:"global"},"GLOBAL"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"GLOBAL")," = ",(0,i.kt)("inlineCode",{parentName:"p"},"2")),(0,i.kt)("p",null,"Operations performed by any client of the Couchbase Server up to the\ntime of the queries dispatch will be reflected in any index results.\nThis is the slowest of all consistency levels as it requires that the\nserver synchronize its indexes to the current key-value state prior to\nexecution of the query.\nCalled as REQUEST_PLUST in Couchbase Server"),(0,i.kt)("h4",{id:"defined-in"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/search-consistency.ts#L26"},"utils/search-consistency.ts:26")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"local"},"LOCAL"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"LOCAL")," = ",(0,i.kt)("inlineCode",{parentName:"p"},"1")),(0,i.kt)("p",null,"Operations performed by this ottoman instance will be reflected\nin queries performed by this particular ottoman instance. This\ntype of consistency will be slower than no consistency, but faster\nthan GLOBAL as the index state is tracked internally rather than\nrequested from the server.\nCalled as AT_PLUS in Couchbase Server"),(0,i.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/search-consistency.ts#L16"},"utils/search-consistency.ts:16")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"none"},"NONE"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"NONE")," = ",(0,i.kt)("inlineCode",{parentName:"p"},"0")),(0,i.kt)("p",null,"No degree consistency required.\nCalled as NOT_BOUNDED in Couchbase Server."),(0,i.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/search-consistency.ts#L6"},"utils/search-consistency.ts:6")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1a5f8759.4f5f4da1.js b/assets/js/1a5f8759.4f5f4da1.js new file mode 100644 index 00000000..ddd44e42 --- /dev/null +++ b/assets/js/1a5f8759.4f5f4da1.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9789],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=p(n),u=r,k=c["".concat(s,".").concat(u)]||c[u]||m[u]||o;return n?a.createElement(k,i(i({ref:t},d),{},{components:n})):a.createElement(k,i({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const o={sidebar_position:1,title:"How Ottoman Works"},i="How Ottoman Works",l={unversionedId:"advanced/how-ottoman-works",id:"advanced/how-ottoman-works",title:"How Ottoman Works",description:"This section is for those who want to understand how Ottoman works in depth.",source:"@site/docs/advanced/how-ottoman-works.md",sourceDirName:"advanced",slug:"/advanced/how-ottoman-works",permalink:"/docs/advanced/how-ottoman-works",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"How Ottoman Works"},sidebar:"tutorialSidebar",previous:{title:"Transactions",permalink:"/docs/advanced/transactions"},next:{title:"Advanced Concepts",permalink:"/docs/advanced/ottoman"}},s={},p=[{value:"Key Generation Layer",id:"key-generation-layer",level:2},{value:"keyGenerator function",id:"keygenerator-function",level:3},{value:"Override keyGenerator function",id:"override-keygenerator-function",level:4},{value:"Defining a Model",id:"defining-a-model",level:4},{value:"Creating a Document",id:"creating-a-document",level:4},{value:"Retrieving a Document",id:"retrieving-a-document",level:4},{value:"Ottoman vs NodeJS SDK",id:"ottoman-vs-nodejs-sdk",level:2},{value:"Ottoman Schema and Model Definitions",id:"ottoman-schema-and-model-definitions",level:3},{value:"Ottoman vs SDK Connection",id:"ottoman-vs-sdk-connection",level:3},{value:"Model find",id:"model-find",level:3},{value:"SDK:",id:"sdk",level:4},{value:"Ottoman:",id:"ottoman",level:4},{value:"SDK:",id:"sdk-1",level:4},{value:"Ottoman:",id:"ottoman-1",level:4},{value:"Model findOneAndUpdate",id:"model-findoneandupdate",level:3},{value:"SDK:",id:"sdk-2",level:4},{value:"Ottoman:",id:"ottoman-2",level:4},{value:"Model findOneAndRemove",id:"model-findoneandremove",level:3},{value:"SDK:",id:"sdk-3",level:4},{value:"Ottoman:",id:"ottoman-3",level:4},{value:"Bulk Operations",id:"bulk-operations",level:2},{value:"Create Many Documents",id:"create-many-documents",level:3},{value:"SDK",id:"sdk-4",level:4},{value:"OTTOMAN",id:"ottoman-4",level:4},{value:"Conclusions",id:"conclusions",level:3}],d={toc:p};function m(e){let{components:t,...o}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"how-ottoman-works"},"How Ottoman Works"),(0,r.kt)("p",null,"This section is for those who want to understand how Ottoman works in depth."),(0,r.kt)("h2",{id:"key-generation-layer"},"Key Generation Layer"),(0,r.kt)("p",null,"Ottoman provides an abstraction layer to handle the ",(0,r.kt)("inlineCode",{parentName:"p"},"keys")," that will be used to store/access the documents on the Database Server."),(0,r.kt)("p",null,"Developers will only have to work with the ",(0,r.kt)("inlineCode",{parentName:"p"},"document")," ids while ottoman handles the keys automatically for them."),(0,r.kt)("h3",{id:"keygenerator-function"},(0,r.kt)("inlineCode",{parentName:"h3"},"keyGenerator")," function"),(0,r.kt)("p",null,"The default ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function is used to generate all keys by Ottoman in your Couchbase datastore."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const keyGenerator = ({ metadata }) => `${ metadata.modelName }`\n")),(0,r.kt)("p",null,"Using the default ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function that Ottoman provides and assuming your ",(0,r.kt)("inlineCode",{parentName:"p"},"modelName")," is 'User', the key for your document would look like:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"User::0477024c"))),(0,r.kt)("p",null,"::: tip Notice\nThis resulted key is a combination of the prefix as provided by the default ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function (",(0,r.kt)("inlineCode",{parentName:"p"},"${metadata.modelName}"),") ",(0,r.kt)("a",{parentName:"p",href:"/docs/basic/model.html#model-id"},"appended with an ID")," (",(0,r.kt)("inlineCode",{parentName:"p"},"0477024c"),").\n:::"),(0,r.kt)("h4",{id:"override-keygenerator-function"},"Override ",(0,r.kt)("inlineCode",{parentName:"h4"},"keyGenerator")," function"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function allows you to only override the prefix for a key, or completely remove the prefix such that the key always matches the ID of the document generated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const keyGenerator = ({ metadata }) => `${ metadata.scopeName }`\nconst User = model('User', schema, { keyGenerator, scopeName: 'myScope' })\n")),(0,r.kt)("p",null,"In this example we are overriding the ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function and replacing the ",(0,r.kt)("inlineCode",{parentName:"p"},"${metadata.modelName}")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"${metadata.scopeName}"),". Using this override, the key for your document would look like:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"myScope::0477024c"))),(0,r.kt)("p",null,"To understand how ID differs from keys in Ottoman we need to explore creating a model, understand how Ottoman deals with IDs which affect your key and then how to retrieve your document by ID."),(0,r.kt)("h4",{id:"defining-a-model"},"Defining a ",(0,r.kt)("inlineCode",{parentName:"h4"},"Model")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"...\nconst userSchema = new Schema({ name: string });\nconst User = model('User', userSchema);\n")),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Set your rules in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Schema"),"."),(0,r.kt)("li",{parentName:"ol"},"Now you can create your ",(0,r.kt)("inlineCode",{parentName:"li"},"Model")," with the ",(0,r.kt)("inlineCode",{parentName:"li"},"Schema")," defined.")),(0,r.kt)("h4",{id:"creating-a-document"},"Creating a Document"),(0,r.kt)("p",null,"Let see how Ottoman handles a new document creation."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"How to Use",src:n(3078).Z,width:"1057",height:"370"})),(0,r.kt)("p",null,"::: tip Notice\nUsing Ottoman you only need to think about ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," in order to execute CRUD Operations over documents.\nAll the ",(0,r.kt)("inlineCode",{parentName:"p"},"key")," management will be automatically handled by Ottoman.\n:::"),(0,r.kt)("h4",{id:"retrieving-a-document"},"Retrieving a Document"),(0,r.kt)("p",null,"Ottoman provides a ",(0,r.kt)("inlineCode",{parentName:"p"},"findById")," method at the ",(0,r.kt)("inlineCode",{parentName:"p"},"Model")," level to retrieve a document by ",(0,r.kt)("inlineCode",{parentName:"p"},"id"),". See the picture below to understand how it works."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"How to Use",src:n(43).Z,width:"1024",height:"558"})),(0,r.kt)("h2",{id:"ottoman-vs-nodejs-sdk"},"Ottoman vs NodeJS SDK"),(0,r.kt)("p",null,"In this section we will be reviewing some methods of the Ottoman Model, and comparing them with their respective implementation in the Couchbase NodeJs SDK."),(0,r.kt)("p",null,"The environment on which these tests were run has the following characteristics:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Info"),(0,r.kt)("th",{parentName:"tr",align:null},"Properties"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Processor"),(0,r.kt)("td",{parentName:"tr",align:null},"Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RAM"),(0,r.kt)("td",{parentName:"tr",align:null},"16.0 GB")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"System type"),(0,r.kt)("td",{parentName:"tr",align:null},"64-bit operating system, x64-based processor")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Storage"),(0,r.kt)("td",{parentName:"tr",align:null},"SSD 500GB")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SO"),(0,r.kt)("td",{parentName:"tr",align:null},"Windows 10")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},(0,r.kt)("em",{parentName:"strong"},"Couchbase"))),(0,r.kt)("td",{parentName:"tr",align:null},"Enterprise Edition 7.0.0")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},(0,r.kt)("em",{parentName:"strong"},"Couchbase Node.js SDK"))),(0,r.kt)("td",{parentName:"tr",align:null},"v3.2.2")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},(0,r.kt)("em",{parentName:"strong"},"Ottoman"))),(0,r.kt)("td",{parentName:"tr",align:null},"v2.0.0-beta.9")))),(0,r.kt)("admonition",{title:"About metrics",type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"For metrics we run each example around a thousand times and take the average tests run time and ",(0,r.kt)("a",{parentName:"p",href:"https://nodejs.org/api/process.html#process_process"},"heapUsed*")),(0,r.kt)("h5",{parentName:"admonition",id:"heapused-is-the-actual-memory-used-during-the-process-execution-according-to-the-documentation-the-memory-used-by-c-objects-bound-to-javascript-objects-managed-by-v8"},"*",(0,r.kt)("em",{parentName:"h5"},"heapUsed"),': is the actual memory used during the process execution, according to the documentation, the memory used by "C++ objects bound to JavaScript objects managed by V8"')),(0,r.kt)("h3",{id:"ottoman-schema-and-model-definitions"},"Ottoman Schema and Model Definitions"),(0,r.kt)("p",null,"We will use the data model corresponding to the type of ",(0,r.kt)("inlineCode",{parentName:"p"},"airport")," collection, within the ",(0,r.kt)("inlineCode",{parentName:"p"},"travel-sample")," bucket and scope ",(0,r.kt)("inlineCode",{parentName:"p"},"inventory"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Define Geolocation Schema will be part of Airport Schema\nconst GeolocationSchema = new Schema({\n alt: Number,\n lat: { type: Number, required: true },\n lon: { type: Number, required: true },\n accuracy: String,\n});\n\n// Define Airport Schema\nconst AirportSchema = new Schema({\n airportname: { type: String, required: true },\n city: { type: String, required: true },\n country: { type: String, required: true },\n faa: String,\n geo: GeolocationSchema,\n icao: String,\n tz: { type: String, required: true },\n});\n")),(0,r.kt)("p",null,"Our model would look like this:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"// Define Airport model instance\nconst AirportModel = model(\n 'airport', // Model name (collection)\n AirportSchema, // Schema defined\n {\n modelKey: 'type', // Ottoman by default use `_type`\n scopeName: 'inventory', // Collection scope\n keyGeneratorDelimiter: '_', // By default Ottoman use ::\n });\n")),(0,r.kt)("h3",{id:"ottoman-vs-sdk-connection"},"Ottoman vs SDK Connection"),(0,r.kt)("p",null,"Create our Ottoman instance and connect:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const ottoman = new Ottoman();\nawait ottoman.connect({\n connectionString: 'couchbase://127.0.0.1',\n bucketName: 'travel-sample',\n username: 'Administrator',\n password: 'password',\n});\n")),(0,r.kt)("p",null,"Couchbase NodeJs SDK cluster definition:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const cluster = new couchbase.Cluster('couchbase://127.0.0.1', {\n username: 'Administrator',\n password: 'password',\n});\n\nconst bucket = cluster.bucket('travel-sample');\nconst collection = bucket.scope('inventory').collection('airport');\n")),(0,r.kt)("h3",{id:"model-find"},"Model ",(0,r.kt)("em",{parentName:"h3"},(0,r.kt)("a",{parentName:"em",href:"/docs/api/interfaces/imodel.html#find"},"find"))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Let's see a simple filterless search implementation.")),(0,r.kt)("h4",{id:"sdk"},"SDK:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const query = `\n SELECT *\n FROM \\`travel-sample\\`.\\`inventory\\`.\\`airport\\`\n WHERE type = \"airport\"\n LIMIT 1;\n`;\ntry {\n const result = await cluster.query(query);\n console.log('Result:', JSON.stringify(result.rows, null, 2));\n} catch(error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("h4",{id:"ottoman"},"Ottoman:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.find({}, { limit: 1 });\n console.log('Result:', JSON.stringify(result.rows, null, 2));\n} catch(error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Result: [\n {\n "airport": {\n "id": 1254,\n "type": "airport",\n "airportname": "Calais Dunkerque",\n "city": "Calais",\n "country": "France",\n "faa": "CQF",\n "icao": "LFAC",\n "tz": "Europe/Paris",\n "geo": {\n "lat": 50.962097,\n "lon": 1.954764,\n "alt": 12\n }\n }\n }\n]\n')),(0,r.kt)("admonition",{title:"Metrics",type:"tip"},(0,r.kt)("table",{parentName:"admonition"},(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Library"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Time (",(0,r.kt)("em",{parentName:"th"},"ms"),")"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Heap Use (",(0,r.kt)("em",{parentName:"th"},"MB"),")"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Ottoman"),(0,r.kt)("td",{parentName:"tr",align:"right"},"6.8"),(0,r.kt)("td",{parentName:"tr",align:"right"},"9.1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"NodeJs SDK"),(0,r.kt)("td",{parentName:"tr",align:"right"},"6"),(0,r.kt)("td",{parentName:"tr",align:"right"},"9.6"))))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Now using some conditions and sort:")),(0,r.kt)("h4",{id:"sdk-1"},"SDK:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const query = `\n SELECT airportname\n FROM \\`travel-sample\\`.\\`inventory\\`.\\`airport\\`\n WHERE\n country = "France" AND\n airportname LIKE "Aix%" AND\n type = "airport"\n ORDER BY airportname ASC\n`;\ntry {\n const result = await cluster.query(query);\n console.log(\'Result:\', JSON.stringify(result.rows, null, 2));\n} catch(error) {\n console.error(\'Query failed: \', error);\n}\n')),(0,r.kt)("h4",{id:"ottoman-1"},"Ottoman:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.find(\n { country: 'France', airportname: { $like: 'Aix%' } },\n { select: ['airportname'], sort: { airportname: 'ASC' } },\n );\n console.log('Result:', JSON.stringify(result.rows, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Result: [\n {\n "airportname": "Aix Les Bains"\n },\n {\n "airportname": "Aix Les Milles"\n }\n]\n')),(0,r.kt)("admonition",{title:"Metrics",type:"tip"},(0,r.kt)("table",{parentName:"admonition"},(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Library"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Time (",(0,r.kt)("em",{parentName:"th"},"ms"),")"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Heap Use (",(0,r.kt)("em",{parentName:"th"},"MB"),")"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Ottoman"),(0,r.kt)("td",{parentName:"tr",align:"right"},"3.47"),(0,r.kt)("td",{parentName:"tr",align:"right"},"9.1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"NodeJs SDK"),(0,r.kt)("td",{parentName:"tr",align:"right"},"3.43"),(0,r.kt)("td",{parentName:"tr",align:"right"},"9.78"))))),(0,r.kt)("h3",{id:"model-findoneandupdate"},"Model ",(0,r.kt)("em",{parentName:"h3"},(0,r.kt)("a",{parentName:"em",href:"/docs/api/interfaces/imodel.html#findoneandupdate"},"findOneAndUpdate"))),(0,r.kt)("h4",{id:"sdk-2"},"SDK:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const query = `\n SELECT META().id as id\n FROM \\`travel-sample\\`.\\`inventory\\`.\\`airport\\`\n WHERE airportname LIKE \"Aix Les Bains%\"\n AND type = \"airport\"\n LIMIT 1\n`;\n\ntry {\n const response = await cluster.query(query);\n const key = response.rows[0].id;\n const { cas, value } = await collection.get(key);\n\n await collection.replace(key,\n { ...value, airportname: 'Aix Les Bains Updated' },\n { cas }\n );\n const result = await collection.get(key);\n console.log('Result:', JSON.stringify(result.content, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("h4",{id:"ottoman-2"},"Ottoman:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.findOneAndUpdate(\n { airportname: { $like: 'Aix Les Bains%' } },\n { airportname: 'Aix Les Bains Updated' },\n { new: true }, // To get updated object\n );\n console.log('Result:', JSON.stringify(result, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Result: {\n "airportname": "Aix Les Bains",\n "city": "Chambery",\n "country": "France",\n "faa": "CMF",\n "geo": {\n "lat": 45.63805,\n "lon": 5.880225,\n "alt": 779\n },\n "icao": "LFLB",\n "id": 1329,\n "tz": "Europe/Paris",\n "type": "airport"\n}\n')),(0,r.kt)("admonition",{title:"Metrics",type:"tip"},(0,r.kt)("table",{parentName:"admonition"},(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Library"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Time (",(0,r.kt)("em",{parentName:"th"},"ms"),")"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Heap Use (",(0,r.kt)("em",{parentName:"th"},"MB"),")"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Ottoman"),(0,r.kt)("td",{parentName:"tr",align:"right"},"10.08"),(0,r.kt)("td",{parentName:"tr",align:"right"},"10.49")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"NodeJs SDK"),(0,r.kt)("td",{parentName:"tr",align:"right"},"11.06"),(0,r.kt)("td",{parentName:"tr",align:"right"},"7.95"))))),(0,r.kt)("h3",{id:"model-findoneandremove"},"Model ",(0,r.kt)("em",{parentName:"h3"},(0,r.kt)("a",{parentName:"em",href:"/docs/api/interfaces/imodel.html#findoneandremove"},"findOneAndRemove"))),(0,r.kt)("h4",{id:"sdk-3"},"SDK:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const query = `\n SELECT META().id as id\n FROM \\`travel-sample\\`.\\`inventory\\`.\\`airport\\`\n WHERE airportname LIKE "Aix Les Bains%"\n AND type = "airport"\n LIMIT 1\n `;\n\ntry {\n const response = await cluster.query(query);\n const key = response.rows[0].id;\n const { cas } = await collection.get(key);\n const result = await collection.remove(key, { cas });\n console.log(`RESULT: `, result);\n} catch (error) {\n console.error(\'Query failed: \', error);\n}\n')),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"RESULT: MutationResult {\n cas: CbCas { '0': },\n token: undefined\n}\n")),(0,r.kt)("h4",{id:"ottoman-3"},"Ottoman:"),(0,r.kt)("p",null,"In Ottoman using ",(0,r.kt)("inlineCode",{parentName:"p"},"findOneAndRemove")," method we will have the document deleted as a result:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.findOneAndRemove(\n { airportname: { $like: 'Aix Les Bains%' } }\n );\n console.log('Result:', JSON.stringify(result, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Result: {\n "airportname": "Aix Les Bains",\n "city": "Chambery",\n "country": "France",\n "faa": "CMF",\n "geo": {\n "lat": 45.63805,\n "lon": 5.880225,\n "alt": 779\n },\n "icao": "LFLB",\n "id": 1329,\n "tz": "Europe/Paris"\n}\n')),(0,r.kt)("admonition",{title:"Metrics",type:"tip"},(0,r.kt)("table",{parentName:"admonition"},(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Library"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Time (",(0,r.kt)("em",{parentName:"th"},"ms"),")"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Heap Use (",(0,r.kt)("em",{parentName:"th"},"MB"),")"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Ottoman"),(0,r.kt)("td",{parentName:"tr",align:"right"},"11.44"),(0,r.kt)("td",{parentName:"tr",align:"right"},"11.047")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"NodeJs SDK"),(0,r.kt)("td",{parentName:"tr",align:"right"},"14.86"),(0,r.kt)("td",{parentName:"tr",align:"right"},"7.95*"))))),(0,r.kt)("h2",{id:"bulk-operations"},"Bulk Operations"),(0,r.kt)("p",null,"Bulk operations describes how to operate on more than one document at the same time, this is a way to increasing network performance in to pipeline operations with ",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/nodejs-sdk/current/howtos/concurrent-async-apis.html#batching"},(0,r.kt)("inlineCode",{parentName:"a"},"Batching Operations")),". As Node.js inherently performs all operations in an asynchronous manner, no special implementation is required in order to enable batching. Simply perform a number of operations simultaneously, and they will be batched on the network. This happens internally and is highly efficient. Let's see in action with Ottoman and Node SDK:"),(0,r.kt)("h3",{id:"create-many-documents"},"Create Many Documents"),(0,r.kt)("p",null,"For our example implementation we will use ",(0,r.kt)("inlineCode",{parentName:"p"},"bulkAirportDocs")," array as defined next:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const bulkAirportDocs = [\n {\n airportname: 'Airport test 1',\n city: 'City A1',\n country: 'Country A1',\n faa: 'CA1',\n geo: {\n lat: 0.0,\n lon: 0.0,\n alt: 0,\n },\n icao: 'CAC1',\n tz: 'Europe/Paris',\n },\n {\n airportname: 'Airport test 2',\n city: 'City A2',\n country: 'Country A2',\n faa: 'CA2',\n geo: {\n lat: 0.0,\n lon: 0.0,\n alt: 0,\n },\n icao: 'CAC2',\n tz: 'Europe/Paris',\n },\n];\n")),(0,r.kt)("h4",{id:"sdk-4"},"SDK"),(0,r.kt)("p",null,"In the next example we will be using ",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/nodejs-sdk/current/howtos/kv-operations.html#crud-operations"},"Insert")," operation for write a JSON document with a given ID (key) to the database applying batching operation strategy:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"// Note that this behaviour extends to the world of async/await,\n// such that following would be automatically batched across the network:\ntry {\n const result = await Promise.all(\n bulkAirportDocs.map(async (doc) => {\n await collection.insert(`airport_${ doc.id }`, doc);\n const newDoc = await collection.get(`airport_${ doc.id }`);\n return newDoc.content;\n }),\n );\n console.log(`RESULT: `, JSON.stringify(result, null, 2));\n} catch(error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'[\n {\n "id": "b6027254-7071-4e76-9303-aa18f3b93bcd",\n "airportname": "Airport test 1",\n "city": "City A1",\n "country": "Country A1",\n "faa": "CA1",\n "geo": {\n "lat": 0,\n "lon": 0,\n "alt": 0\n },\n "icao": "CAC1",\n "tz": "Europe/Paris"\n },\n {\n "id": "d4331304-e321-45cb-89d2-23530240b9bd",\n "airportname": "Airport test 2",\n "city": "City A2",\n "country": "Country A2",\n "faa": "CA2",\n "geo": {\n "lat": 0,\n "lon": 0,\n "alt": 0\n },\n "icao": "CAC2",\n "tz": "Europe/Paris"\n }\n]\n')),(0,r.kt)("h4",{id:"ottoman-4"},"OTTOMAN"),(0,r.kt)("p",null,"The way to do the same example above in Ottoman is as simple as using Model's ",(0,r.kt)("a",{parentName:"p",href:"/docs/advanced/how-ottoman-works.html#bulk-operations"},"createMany")," function as we can see below:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.createMany(bulkAirportDocs);\n console.log(JSON.stringify(result, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'{\n "status": "SUCCESS",\n "message": {\n "success": 2,\n "match_number": 2,\n "errors": [],\n "data": [\n {\n "airportname": "Airport test 1",\n "city": "City A1",\n "country": "Country A1",\n "faa": "CA1",\n "geo": {\n "lat": 0,\n "lon": 0,\n "alt": 0\n },\n "icao": "CAC1",\n "tz": "Europe/Paris",\n "id": "b6027254-7071-4e76-9303-aa18f3b93bcd",\n "type": "airport"\n },\n {\n "airportname": "Airport test 2",\n "city": "City A2",\n "country": "Country A2",\n "faa": "CA2",\n "geo": {\n "lat": 0,\n "lon": 0,\n "alt": 0\n },\n "icao": "CAC2",\n "tz": "Europe/Paris",\n "id": "d4331304-e321-45cb-89d2-23530240b9bd",\n "type": "airport"\n }\n ]\n }\n}\n')),(0,r.kt)("h3",{id:"conclusions"},"Conclusions"),(0,r.kt)("p",null,"As can be appreciated for most of the search operations through filters in the Couchbase SDK, we must define our N1QL sentences while Ottoman internally takes care of it. Ottoman provides a method of interacting with a database using an object-oriented language, although it also allows the direct use of N1QL queries. Developers can interact with the database without becoming an expert in N1QL, which can save time and keep code streamlined, especially when is not that familiar with N1QL language, eliminating repetitive code and reducing the time taken in repetitive development tasks such as changes to the object model would be made in one place. The Ottoman abstraction layer allows us to focus exclusively on the use of the ODM and leave the management and interaction of the low-level database to it, however, insulates the developer from that layer, at times can potentially make it difficult to solve low-level problems."))}m.isMDXComponent=!0},3078:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/create-63635341b5b5fde5571c1ec811505290.png"},43:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/findById-ef14e5e8ad61a6e162c72f48861567b7.png"}}]); \ No newline at end of file diff --git a/assets/js/1a5f8759.92f02db4.js b/assets/js/1a5f8759.92f02db4.js deleted file mode 100644 index 005d0ac4..00000000 --- a/assets/js/1a5f8759.92f02db4.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9789],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=a.createContext({}),p=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=p(e.components);return a.createElement(s.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},c=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,s=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),c=p(n),u=r,k=c["".concat(s,".").concat(u)]||c[u]||m[u]||o;return n?a.createElement(k,i(i({ref:t},d),{},{components:n})):a.createElement(k,i({ref:t},d))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=c;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>m,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const o={sidebar_position:1,title:"How Ottoman Works"},i="How Ottoman Works",l={unversionedId:"advanced/how-ottoman-works",id:"advanced/how-ottoman-works",title:"How Ottoman Works",description:"This section is for those who want to understand how Ottoman works in depth.",source:"@site/docs/advanced/how-ottoman-works.md",sourceDirName:"advanced",slug:"/advanced/how-ottoman-works",permalink:"/docs/advanced/how-ottoman-works",draft:!1,tags:[],version:"current",sidebarPosition:1,frontMatter:{sidebar_position:1,title:"How Ottoman Works"},sidebar:"tutorialSidebar",previous:{title:"Full Text Search",permalink:"/docs/advanced/fts"},next:{title:"Advanced Concepts",permalink:"/docs/advanced/ottoman"}},s={},p=[{value:"Key Generation Layer",id:"key-generation-layer",level:2},{value:"keyGenerator function",id:"keygenerator-function",level:3},{value:"Override keyGenerator function",id:"override-keygenerator-function",level:4},{value:"Defining a Model",id:"defining-a-model",level:4},{value:"Creating a Document",id:"creating-a-document",level:4},{value:"Retrieving a Document",id:"retrieving-a-document",level:4},{value:"Ottoman vs NodeJS SDK",id:"ottoman-vs-nodejs-sdk",level:2},{value:"Ottoman Schema and Model Definitions",id:"ottoman-schema-and-model-definitions",level:3},{value:"Ottoman vs SDK Connection",id:"ottoman-vs-sdk-connection",level:3},{value:"Model find",id:"model-find",level:3},{value:"SDK:",id:"sdk",level:4},{value:"Ottoman:",id:"ottoman",level:4},{value:"SDK:",id:"sdk-1",level:4},{value:"Ottoman:",id:"ottoman-1",level:4},{value:"Model findOneAndUpdate",id:"model-findoneandupdate",level:3},{value:"SDK:",id:"sdk-2",level:4},{value:"Ottoman:",id:"ottoman-2",level:4},{value:"Model findOneAndRemove",id:"model-findoneandremove",level:3},{value:"SDK:",id:"sdk-3",level:4},{value:"Ottoman:",id:"ottoman-3",level:4},{value:"Bulk Operations",id:"bulk-operations",level:2},{value:"Create Many Documents",id:"create-many-documents",level:3},{value:"SDK",id:"sdk-4",level:4},{value:"OTTOMAN",id:"ottoman-4",level:4},{value:"Conclusions",id:"conclusions",level:3}],d={toc:p};function m(e){let{components:t,...o}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,o,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"how-ottoman-works"},"How Ottoman Works"),(0,r.kt)("p",null,"This section is for those who want to understand how Ottoman works in depth."),(0,r.kt)("h2",{id:"key-generation-layer"},"Key Generation Layer"),(0,r.kt)("p",null,"Ottoman provides an abstraction layer to handle the ",(0,r.kt)("inlineCode",{parentName:"p"},"keys")," that will be used to store/access the documents on the Database Server."),(0,r.kt)("p",null,"Developers will only have to work with the ",(0,r.kt)("inlineCode",{parentName:"p"},"document")," ids while ottoman handles the keys automatically for them."),(0,r.kt)("h3",{id:"keygenerator-function"},(0,r.kt)("inlineCode",{parentName:"h3"},"keyGenerator")," function"),(0,r.kt)("p",null,"The default ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function is used to generate all keys by Ottoman in your Couchbase datastore."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const keyGenerator = ({ metadata }) => `${ metadata.modelName }`\n")),(0,r.kt)("p",null,"Using the default ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function that Ottoman provides and assuming your ",(0,r.kt)("inlineCode",{parentName:"p"},"modelName")," is 'User', the key for your document would look like:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"User::0477024c"))),(0,r.kt)("p",null,"::: tip Notice\nThis resulted key is a combination of the prefix as provided by the default ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function (",(0,r.kt)("inlineCode",{parentName:"p"},"${metadata.modelName}"),") ",(0,r.kt)("a",{parentName:"p",href:"/docs/basic/model.html#model-id"},"appended with an ID")," (",(0,r.kt)("inlineCode",{parentName:"p"},"0477024c"),").\n:::"),(0,r.kt)("h4",{id:"override-keygenerator-function"},"Override ",(0,r.kt)("inlineCode",{parentName:"h4"},"keyGenerator")," function"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function allows you to only override the prefix for a key, or completely remove the prefix such that the key always matches the ID of the document generated."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const keyGenerator = ({ metadata }) => `${ metadata.scopeName }`\nconst User = model('User', schema, { keyGenerator, scopeName: 'myScope' })\n")),(0,r.kt)("p",null,"In this example we are overriding the ",(0,r.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function and replacing the ",(0,r.kt)("inlineCode",{parentName:"p"},"${metadata.modelName}")," with ",(0,r.kt)("inlineCode",{parentName:"p"},"${metadata.scopeName}"),". Using this override, the key for your document would look like:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("inlineCode",{parentName:"li"},"myScope::0477024c"))),(0,r.kt)("p",null,"To understand how ID differs from keys in Ottoman we need to explore creating a model, understand how Ottoman deals with IDs which affect your key and then how to retrieve your document by ID."),(0,r.kt)("h4",{id:"defining-a-model"},"Defining a ",(0,r.kt)("inlineCode",{parentName:"h4"},"Model")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"...\nconst userSchema = new Schema({ name: string });\nconst User = model('User', userSchema);\n")),(0,r.kt)("ol",null,(0,r.kt)("li",{parentName:"ol"},"Set your rules in the ",(0,r.kt)("inlineCode",{parentName:"li"},"Schema"),"."),(0,r.kt)("li",{parentName:"ol"},"Now you can create your ",(0,r.kt)("inlineCode",{parentName:"li"},"Model")," with the ",(0,r.kt)("inlineCode",{parentName:"li"},"Schema")," defined.")),(0,r.kt)("h4",{id:"creating-a-document"},"Creating a Document"),(0,r.kt)("p",null,"Let see how Ottoman handles a new document creation."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"How to Use",src:n(3078).Z,width:"1057",height:"370"})),(0,r.kt)("p",null,"::: tip Notice\nUsing Ottoman you only need to think about ",(0,r.kt)("inlineCode",{parentName:"p"},"id")," in order to execute CRUD Operations over documents.\nAll the ",(0,r.kt)("inlineCode",{parentName:"p"},"key")," management will be automatically handled by Ottoman.\n:::"),(0,r.kt)("h4",{id:"retrieving-a-document"},"Retrieving a Document"),(0,r.kt)("p",null,"Ottoman provides a ",(0,r.kt)("inlineCode",{parentName:"p"},"findById")," method at the ",(0,r.kt)("inlineCode",{parentName:"p"},"Model")," level to retrieve a document by ",(0,r.kt)("inlineCode",{parentName:"p"},"id"),". See the picture below to understand how it works."),(0,r.kt)("p",null,(0,r.kt)("img",{alt:"How to Use",src:n(43).Z,width:"1024",height:"558"})),(0,r.kt)("h2",{id:"ottoman-vs-nodejs-sdk"},"Ottoman vs NodeJS SDK"),(0,r.kt)("p",null,"In this section we will be reviewing some methods of the Ottoman Model, and comparing them with their respective implementation in the Couchbase NodeJs SDK."),(0,r.kt)("p",null,"The environment on which these tests were run has the following characteristics:"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Info"),(0,r.kt)("th",{parentName:"tr",align:null},"Properties"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Processor"),(0,r.kt)("td",{parentName:"tr",align:null},"Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"RAM"),(0,r.kt)("td",{parentName:"tr",align:null},"16.0 GB")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"System type"),(0,r.kt)("td",{parentName:"tr",align:null},"64-bit operating system, x64-based processor")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Storage"),(0,r.kt)("td",{parentName:"tr",align:null},"SSD 500GB")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"SO"),(0,r.kt)("td",{parentName:"tr",align:null},"Windows 10")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},(0,r.kt)("em",{parentName:"strong"},"Couchbase"))),(0,r.kt)("td",{parentName:"tr",align:null},"Enterprise Edition 7.0.0")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},(0,r.kt)("em",{parentName:"strong"},"Couchbase Node.js SDK"))),(0,r.kt)("td",{parentName:"tr",align:null},"v3.2.2")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},(0,r.kt)("strong",{parentName:"td"},(0,r.kt)("em",{parentName:"strong"},"Ottoman"))),(0,r.kt)("td",{parentName:"tr",align:null},"v2.0.0-beta.9")))),(0,r.kt)("admonition",{title:"About metrics",type:"tip"},(0,r.kt)("p",{parentName:"admonition"},"For metrics we run each example around a thousand times and take the average tests run time and ",(0,r.kt)("a",{parentName:"p",href:"https://nodejs.org/api/process.html#process_process"},"heapUsed*")),(0,r.kt)("h5",{parentName:"admonition",id:"heapused-is-the-actual-memory-used-during-the-process-execution-according-to-the-documentation-the-memory-used-by-c-objects-bound-to-javascript-objects-managed-by-v8"},"*",(0,r.kt)("em",{parentName:"h5"},"heapUsed"),': is the actual memory used during the process execution, according to the documentation, the memory used by "C++ objects bound to JavaScript objects managed by V8"')),(0,r.kt)("h3",{id:"ottoman-schema-and-model-definitions"},"Ottoman Schema and Model Definitions"),(0,r.kt)("p",null,"We will use the data model corresponding to the type of ",(0,r.kt)("inlineCode",{parentName:"p"},"airport")," collection, within the ",(0,r.kt)("inlineCode",{parentName:"p"},"travel-sample")," bucket and scope ",(0,r.kt)("inlineCode",{parentName:"p"},"inventory"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// Define Geolocation Schema will be part of Airport Schema\nconst GeolocationSchema = new Schema({\n alt: Number,\n lat: { type: Number, required: true },\n lon: { type: Number, required: true },\n accuracy: String,\n});\n\n// Define Airport Schema\nconst AirportSchema = new Schema({\n airportname: { type: String, required: true },\n city: { type: String, required: true },\n country: { type: String, required: true },\n faa: String,\n geo: GeolocationSchema,\n icao: String,\n tz: { type: String, required: true },\n});\n")),(0,r.kt)("p",null,"Our model would look like this:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"// Define Airport model instance\nconst AirportModel = model(\n 'airport', // Model name (collection)\n AirportSchema, // Schema defined\n {\n modelKey: 'type', // Ottoman by default use `_type`\n scopeName: 'inventory', // Collection scope\n keyGeneratorDelimiter: '_', // By default Ottoman use ::\n });\n")),(0,r.kt)("h3",{id:"ottoman-vs-sdk-connection"},"Ottoman vs SDK Connection"),(0,r.kt)("p",null,"Create our Ottoman instance and connect:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const ottoman = new Ottoman();\nawait ottoman.connect({\n connectionString: 'couchbase://127.0.0.1',\n bucketName: 'travel-sample',\n username: 'Administrator',\n password: 'password',\n});\n")),(0,r.kt)("p",null,"Couchbase NodeJs SDK cluster definition:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const cluster = new couchbase.Cluster('couchbase://127.0.0.1', {\n username: 'Administrator',\n password: 'password',\n});\n\nconst bucket = cluster.bucket('travel-sample');\nconst collection = bucket.scope('inventory').collection('airport');\n")),(0,r.kt)("h3",{id:"model-find"},"Model ",(0,r.kt)("em",{parentName:"h3"},(0,r.kt)("a",{parentName:"em",href:"/docs/api/interfaces/imodel.html#find"},"find"))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Let's see a simple filterless search implementation.")),(0,r.kt)("h4",{id:"sdk"},"SDK:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const query = `\n SELECT *\n FROM \\`travel-sample\\`.\\`inventory\\`.\\`airport\\`\n WHERE type = \"airport\"\n LIMIT 1;\n`;\ntry {\n const result = await cluster.query(query);\n console.log('Result:', JSON.stringify(result.rows, null, 2));\n} catch(error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("h4",{id:"ottoman"},"Ottoman:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.find({}, { limit: 1 });\n console.log('Result:', JSON.stringify(result.rows, null, 2));\n} catch(error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Result: [\n {\n "airport": {\n "id": 1254,\n "type": "airport",\n "airportname": "Calais Dunkerque",\n "city": "Calais",\n "country": "France",\n "faa": "CQF",\n "icao": "LFAC",\n "tz": "Europe/Paris",\n "geo": {\n "lat": 50.962097,\n "lon": 1.954764,\n "alt": 12\n }\n }\n }\n]\n')),(0,r.kt)("admonition",{title:"Metrics",type:"tip"},(0,r.kt)("table",{parentName:"admonition"},(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Library"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Time (",(0,r.kt)("em",{parentName:"th"},"ms"),")"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Heap Use (",(0,r.kt)("em",{parentName:"th"},"MB"),")"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Ottoman"),(0,r.kt)("td",{parentName:"tr",align:"right"},"6.8"),(0,r.kt)("td",{parentName:"tr",align:"right"},"9.1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"NodeJs SDK"),(0,r.kt)("td",{parentName:"tr",align:"right"},"6"),(0,r.kt)("td",{parentName:"tr",align:"right"},"9.6"))))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"Now using some conditions and sort:")),(0,r.kt)("h4",{id:"sdk-1"},"SDK:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const query = `\n SELECT airportname\n FROM \\`travel-sample\\`.\\`inventory\\`.\\`airport\\`\n WHERE\n country = "France" AND\n airportname LIKE "Aix%" AND\n type = "airport"\n ORDER BY airportname ASC\n`;\ntry {\n const result = await cluster.query(query);\n console.log(\'Result:\', JSON.stringify(result.rows, null, 2));\n} catch(error) {\n console.error(\'Query failed: \', error);\n}\n')),(0,r.kt)("h4",{id:"ottoman-1"},"Ottoman:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.find(\n { country: 'France', airportname: { $like: 'Aix%' } },\n { select: ['airportname'], sort: { airportname: 'ASC' } },\n );\n console.log('Result:', JSON.stringify(result.rows, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Result: [\n {\n "airportname": "Aix Les Bains"\n },\n {\n "airportname": "Aix Les Milles"\n }\n]\n')),(0,r.kt)("admonition",{title:"Metrics",type:"tip"},(0,r.kt)("table",{parentName:"admonition"},(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Library"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Time (",(0,r.kt)("em",{parentName:"th"},"ms"),")"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Heap Use (",(0,r.kt)("em",{parentName:"th"},"MB"),")"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Ottoman"),(0,r.kt)("td",{parentName:"tr",align:"right"},"3.47"),(0,r.kt)("td",{parentName:"tr",align:"right"},"9.1")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"NodeJs SDK"),(0,r.kt)("td",{parentName:"tr",align:"right"},"3.43"),(0,r.kt)("td",{parentName:"tr",align:"right"},"9.78"))))),(0,r.kt)("h3",{id:"model-findoneandupdate"},"Model ",(0,r.kt)("em",{parentName:"h3"},(0,r.kt)("a",{parentName:"em",href:"/docs/api/interfaces/imodel.html#findoneandupdate"},"findOneAndUpdate"))),(0,r.kt)("h4",{id:"sdk-2"},"SDK:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const query = `\n SELECT META().id as id\n FROM \\`travel-sample\\`.\\`inventory\\`.\\`airport\\`\n WHERE airportname LIKE \"Aix Les Bains%\"\n AND type = \"airport\"\n LIMIT 1\n`;\n\ntry {\n const response = await cluster.query(query);\n const key = response.rows[0].id;\n const { cas, value } = await collection.get(key);\n\n await collection.replace(key,\n { ...value, airportname: 'Aix Les Bains Updated' },\n { cas }\n );\n const result = await collection.get(key);\n console.log('Result:', JSON.stringify(result.content, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("h4",{id:"ottoman-2"},"Ottoman:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.findOneAndUpdate(\n { airportname: { $like: 'Aix Les Bains%' } },\n { airportname: 'Aix Les Bains Updated' },\n { new: true }, // To get updated object\n );\n console.log('Result:', JSON.stringify(result, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Result: {\n "airportname": "Aix Les Bains",\n "city": "Chambery",\n "country": "France",\n "faa": "CMF",\n "geo": {\n "lat": 45.63805,\n "lon": 5.880225,\n "alt": 779\n },\n "icao": "LFLB",\n "id": 1329,\n "tz": "Europe/Paris",\n "type": "airport"\n}\n')),(0,r.kt)("admonition",{title:"Metrics",type:"tip"},(0,r.kt)("table",{parentName:"admonition"},(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Library"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Time (",(0,r.kt)("em",{parentName:"th"},"ms"),")"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Heap Use (",(0,r.kt)("em",{parentName:"th"},"MB"),")"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Ottoman"),(0,r.kt)("td",{parentName:"tr",align:"right"},"10.08"),(0,r.kt)("td",{parentName:"tr",align:"right"},"10.49")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"NodeJs SDK"),(0,r.kt)("td",{parentName:"tr",align:"right"},"11.06"),(0,r.kt)("td",{parentName:"tr",align:"right"},"7.95"))))),(0,r.kt)("h3",{id:"model-findoneandremove"},"Model ",(0,r.kt)("em",{parentName:"h3"},(0,r.kt)("a",{parentName:"em",href:"/docs/api/interfaces/imodel.html#findoneandremove"},"findOneAndRemove"))),(0,r.kt)("h4",{id:"sdk-3"},"SDK:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const query = `\n SELECT META().id as id\n FROM \\`travel-sample\\`.\\`inventory\\`.\\`airport\\`\n WHERE airportname LIKE "Aix Les Bains%"\n AND type = "airport"\n LIMIT 1\n `;\n\ntry {\n const response = await cluster.query(query);\n const key = response.rows[0].id;\n const { cas } = await collection.get(key);\n const result = await collection.remove(key, { cas });\n console.log(`RESULT: `, result);\n} catch (error) {\n console.error(\'Query failed: \', error);\n}\n')),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},"RESULT: MutationResult {\n cas: CbCas { '0': },\n token: undefined\n}\n")),(0,r.kt)("h4",{id:"ottoman-3"},"Ottoman:"),(0,r.kt)("p",null,"In Ottoman using ",(0,r.kt)("inlineCode",{parentName:"p"},"findOneAndRemove")," method we will have the document deleted as a result:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.findOneAndRemove(\n { airportname: { $like: 'Aix Les Bains%' } }\n );\n console.log('Result:', JSON.stringify(result, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'Result: {\n "airportname": "Aix Les Bains",\n "city": "Chambery",\n "country": "France",\n "faa": "CMF",\n "geo": {\n "lat": 45.63805,\n "lon": 5.880225,\n "alt": 779\n },\n "icao": "LFLB",\n "id": 1329,\n "tz": "Europe/Paris"\n}\n')),(0,r.kt)("admonition",{title:"Metrics",type:"tip"},(0,r.kt)("table",{parentName:"admonition"},(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:null},"Library"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Time (",(0,r.kt)("em",{parentName:"th"},"ms"),")"),(0,r.kt)("th",{parentName:"tr",align:"right"},"Heap Use (",(0,r.kt)("em",{parentName:"th"},"MB"),")"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"Ottoman"),(0,r.kt)("td",{parentName:"tr",align:"right"},"11.44"),(0,r.kt)("td",{parentName:"tr",align:"right"},"11.047")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:null},"NodeJs SDK"),(0,r.kt)("td",{parentName:"tr",align:"right"},"14.86"),(0,r.kt)("td",{parentName:"tr",align:"right"},"7.95*"))))),(0,r.kt)("h2",{id:"bulk-operations"},"Bulk Operations"),(0,r.kt)("p",null,"Bulk operations describes how to operate on more than one document at the same time, this is a way to increasing network performance in to pipeline operations with ",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/nodejs-sdk/current/howtos/concurrent-async-apis.html#batching"},(0,r.kt)("inlineCode",{parentName:"a"},"Batching Operations")),". As Node.js inherently performs all operations in an asynchronous manner, no special implementation is required in order to enable batching. Simply perform a number of operations simultaneously, and they will be batched on the network. This happens internally and is highly efficient. Let's see in action with Ottoman and Node SDK:"),(0,r.kt)("h3",{id:"create-many-documents"},"Create Many Documents"),(0,r.kt)("p",null,"For our example implementation we will use ",(0,r.kt)("inlineCode",{parentName:"p"},"bulkAirportDocs")," array as defined next:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const bulkAirportDocs = [\n {\n airportname: 'Airport test 1',\n city: 'City A1',\n country: 'Country A1',\n faa: 'CA1',\n geo: {\n lat: 0.0,\n lon: 0.0,\n alt: 0,\n },\n icao: 'CAC1',\n tz: 'Europe/Paris',\n },\n {\n airportname: 'Airport test 2',\n city: 'City A2',\n country: 'Country A2',\n faa: 'CA2',\n geo: {\n lat: 0.0,\n lon: 0.0,\n alt: 0,\n },\n icao: 'CAC2',\n tz: 'Europe/Paris',\n },\n];\n")),(0,r.kt)("h4",{id:"sdk-4"},"SDK"),(0,r.kt)("p",null,"In the next example we will be using ",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/nodejs-sdk/current/howtos/kv-operations.html#crud-operations"},"Insert")," operation for write a JSON document with a given ID (key) to the database applying batching operation strategy:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"// Note that this behaviour extends to the world of async/await,\n// such that following would be automatically batched across the network:\ntry {\n const result = await Promise.all(\n bulkAirportDocs.map(async (doc) => {\n await collection.insert(`airport_${ doc.id }`, doc);\n const newDoc = await collection.get(`airport_${ doc.id }`);\n return newDoc.content;\n }),\n );\n console.log(`RESULT: `, JSON.stringify(result, null, 2));\n} catch(error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'[\n {\n "id": "b6027254-7071-4e76-9303-aa18f3b93bcd",\n "airportname": "Airport test 1",\n "city": "City A1",\n "country": "Country A1",\n "faa": "CA1",\n "geo": {\n "lat": 0,\n "lon": 0,\n "alt": 0\n },\n "icao": "CAC1",\n "tz": "Europe/Paris"\n },\n {\n "id": "d4331304-e321-45cb-89d2-23530240b9bd",\n "airportname": "Airport test 2",\n "city": "City A2",\n "country": "Country A2",\n "faa": "CA2",\n "geo": {\n "lat": 0,\n "lon": 0,\n "alt": 0\n },\n "icao": "CAC2",\n "tz": "Europe/Paris"\n }\n]\n')),(0,r.kt)("h4",{id:"ottoman-4"},"OTTOMAN"),(0,r.kt)("p",null,"The way to do the same example above in Ottoman is as simple as using Model's ",(0,r.kt)("a",{parentName:"p",href:"/docs/advanced/how-ottoman-works.html#bulk-operations"},"createMany")," function as we can see below:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n const result = await AirportModel.createMany(bulkAirportDocs);\n console.log(JSON.stringify(result, null, 2));\n} catch (error) {\n console.error('Query failed: ', error);\n}\n")),(0,r.kt)("p",null,"Output:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sh"},'{\n "status": "SUCCESS",\n "message": {\n "success": 2,\n "match_number": 2,\n "errors": [],\n "data": [\n {\n "airportname": "Airport test 1",\n "city": "City A1",\n "country": "Country A1",\n "faa": "CA1",\n "geo": {\n "lat": 0,\n "lon": 0,\n "alt": 0\n },\n "icao": "CAC1",\n "tz": "Europe/Paris",\n "id": "b6027254-7071-4e76-9303-aa18f3b93bcd",\n "type": "airport"\n },\n {\n "airportname": "Airport test 2",\n "city": "City A2",\n "country": "Country A2",\n "faa": "CA2",\n "geo": {\n "lat": 0,\n "lon": 0,\n "alt": 0\n },\n "icao": "CAC2",\n "tz": "Europe/Paris",\n "id": "d4331304-e321-45cb-89d2-23530240b9bd",\n "type": "airport"\n }\n ]\n }\n}\n')),(0,r.kt)("h3",{id:"conclusions"},"Conclusions"),(0,r.kt)("p",null,"As can be appreciated for most of the search operations through filters in the Couchbase SDK, we must define our N1QL sentences while Ottoman internally takes care of it. Ottoman provides a method of interacting with a database using an object-oriented language, although it also allows the direct use of N1QL queries. Developers can interact with the database without becoming an expert in N1QL, which can save time and keep code streamlined, especially when is not that familiar with N1QL language, eliminating repetitive code and reducing the time taken in repetitive development tasks such as changes to the object model would be made in one place. The Ottoman abstraction layer allows us to focus exclusively on the use of the ODM and leave the management and interaction of the low-level database to it, however, insulates the developer from that layer, at times can potentially make it difficult to solve low-level problems."))}m.isMDXComponent=!0},3078:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/create-63635341b5b5fde5571c1ec811505290.png"},43:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/findById-ef14e5e8ad61a6e162c72f48861567b7.png"}}]); \ No newline at end of file diff --git a/assets/js/1dc01822.6423fddd.js b/assets/js/1dc01822.de3eaebb.js similarity index 97% rename from assets/js/1dc01822.6423fddd.js rename to assets/js/1dc01822.de3eaebb.js index 3bd2f4e0..539e66ef 100644 --- a/assets/js/1dc01822.6423fddd.js +++ b/assets/js/1dc01822.de3eaebb.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[56],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(n),f=i,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return n?r.createElement(m,o(o({ref:t},s),{},{components:n})):r.createElement(m,o({ref:t},s))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var r=n(7462),i=(n(7294),n(3905));const a={id:"IField",title:"Interface: IField",sidebar_label:"IField",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/interfaces/IField",id:"api/interfaces/IField",title:"Interface: IField",description:"SELECT field structure",source:"@site/docs/api/interfaces/IField.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IField",permalink:"/docs/api/interfaces/IField",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IField",title:"Interface: IField",sidebar_label:"IField",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IConditionExpr",permalink:"/docs/api/interfaces/IConditionExpr"},next:{title:"IIndexOnParams",permalink:"/docs/api/interfaces/IIndexOnParams"}},p={},c=[{value:"Properties",id:"properties",level:2},{value:"as",id:"as",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"name",id:"name",level:3},{value:"Defined in",id:"defined-in-1",level:4}],s={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"SELECT field structure"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," e.g { name: 'address', as: 'addr' }\n")),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"as"},"as"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,i.kt)("strong",{parentName:"p"},"as"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("h4",{id:"defined-in"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L182"},"query/interface/query.types.ts:182")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"name"},"name"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"name"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L181"},"query/interface/query.types.ts:181")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[56],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var r=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),c=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=c(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,p=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=c(n),f=i,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||a;return n?r.createElement(m,o(o({ref:t},s),{},{components:n})):r.createElement(m,o({ref:t},s))}));function f(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var c=2;c{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>l,toc:()=>c});var r=n(7462),i=(n(7294),n(3905));const a={id:"IField",title:"Interface: IField",sidebar_label:"IField",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/interfaces/IField",id:"api/interfaces/IField",title:"Interface: IField",description:"SELECT field structure",source:"@site/docs/api/interfaces/IField.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IField",permalink:"/docs/api/interfaces/IField",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IField",title:"Interface: IField",sidebar_label:"IField",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IConditionExpr",permalink:"/docs/api/interfaces/IConditionExpr"},next:{title:"IIndexOnParams",permalink:"/docs/api/interfaces/IIndexOnParams"}},p={},c=[{value:"Properties",id:"properties",level:2},{value:"as",id:"as",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"name",id:"name",level:3},{value:"Defined in",id:"defined-in-1",level:4}],s={toc:c};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"SELECT field structure"),(0,i.kt)("p",null,(0,i.kt)("strong",{parentName:"p"},(0,i.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," e.g { name: 'address', as: 'addr' }\n")),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"as"},"as"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,i.kt)("strong",{parentName:"p"},"as"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("h4",{id:"defined-in"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L182"},"query/interface/query.types.ts:182")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"name"},"name"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"name"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"string")),(0,i.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L181"},"query/interface/query.types.ts:181")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/1f30904d.2c9b636b.js b/assets/js/1f30904d.c1792157.js similarity index 88% rename from assets/js/1f30904d.2c9b636b.js rename to assets/js/1f30904d.c1792157.js index 528a32a6..8f6c3f5d 100644 --- a/assets/js/1f30904d.2c9b636b.js +++ b/assets/js/1f30904d.c1792157.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[1117],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||i;return n?r.createElement(f,o(o({ref:t},c),{},{components:n})):r.createElement(f,o({ref:t},c))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(7462),a=(n(7294),n(3905));const i={id:"IIndexOnParams",title:"Interface: IIndexOnParams",sidebar_label:"IIndexOnParams",sidebar_position:0,custom_edit_url:null},o=void 0,s={unversionedId:"api/interfaces/IIndexOnParams",id:"api/interfaces/IIndexOnParams",title:"Interface: IIndexOnParams",description:"Index ON clause types",source:"@site/docs/api/interfaces/IIndexOnParams.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IIndexOnParams",permalink:"/docs/api/interfaces/IIndexOnParams",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IIndexOnParams",title:"Interface: IIndexOnParams",sidebar_label:"IIndexOnParams",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IField",permalink:"/docs/api/interfaces/IField"},next:{title:"IIndexWithParams",permalink:"/docs/api/interfaces/IIndexWithParams"}},l={},p=[{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"sort",id:"sort",level:3},{value:"Defined in",id:"defined-in-1",level:4}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Index ON clause types"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"name"},"name"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"name"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L283"},"query/interface/query.types.ts:283")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sort"},"sort"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"sort"),": ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,a.kt)("inlineCode",{parentName:"a"},"SortType"))),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L284"},"query/interface/query.types.ts:284")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[1117],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,c=s(e,["components","mdxType","originalType","parentName"]),u=p(n),f=a,m=u["".concat(l,".").concat(f)]||u[f]||d[f]||i;return n?r.createElement(m,o(o({ref:t},c),{},{components:n})):r.createElement(m,o({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(7462),a=(n(7294),n(3905));const i={id:"IIndexOnParams",title:"Interface: IIndexOnParams",sidebar_label:"IIndexOnParams",sidebar_position:0,custom_edit_url:null},o=void 0,s={unversionedId:"api/interfaces/IIndexOnParams",id:"api/interfaces/IIndexOnParams",title:"Interface: IIndexOnParams",description:"Index ON clause types",source:"@site/docs/api/interfaces/IIndexOnParams.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IIndexOnParams",permalink:"/docs/api/interfaces/IIndexOnParams",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IIndexOnParams",title:"Interface: IIndexOnParams",sidebar_label:"IIndexOnParams",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IField",permalink:"/docs/api/interfaces/IField"},next:{title:"IIndexWithParams",permalink:"/docs/api/interfaces/IIndexWithParams"}},l={},p=[{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"sort",id:"sort",level:3},{value:"Defined in",id:"defined-in-1",level:4}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Index ON clause types"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"name"},"name"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"name"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L283"},"query/interface/query.types.ts:283")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sort"},"sort"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"sort"),": ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,a.kt)("inlineCode",{parentName:"a"},"SortType"))),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L284"},"query/interface/query.types.ts:284")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2750fe84.7fd11f1b.js b/assets/js/2750fe84.7fd11f1b.js deleted file mode 100644 index 12f95a9c..00000000 --- a/assets/js/2750fe84.7fd11f1b.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7453],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>f});var i=t(7294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function l(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function a(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var r=i.createContext({}),d=function(e){var n=i.useContext(r),t=n;return e&&(t="function"==typeof e?e(n):a(a({},n),e)),t},s=function(e){var n=d(e.components);return i.createElement(r.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},c=i.forwardRef((function(e,n){var t=e.components,o=e.mdxType,l=e.originalType,r=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=d(t),f=o,u=c["".concat(r,".").concat(f)]||c[f]||m[f]||l;return t?i.createElement(u,a(a({ref:n},s),{},{components:t})):i.createElement(u,a({ref:n},s))}));function f(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var l=t.length,a=new Array(l);a[0]=c;var p={};for(var r in n)hasOwnProperty.call(n,r)&&(p[r]=n[r]);p.originalType=e,p.mdxType="string"==typeof e?e:o,a[1]=p;for(var d=2;d{t.r(n),t.d(n,{assets:()=>r,contentTitle:()=>a,default:()=>m,frontMatter:()=>l,metadata:()=>p,toc:()=>d});var i=t(7462),o=(t(7294),t(3905));const l={id:"FindOptions",title:"Class: FindOptions",sidebar_label:"FindOptions",sidebar_position:0,custom_edit_url:null},a=void 0,p={unversionedId:"api/classes/FindOptions",id:"api/classes/FindOptions",title:"Class: FindOptions",description:"Implements",source:"@site/docs/api/classes/FindOptions.md",sourceDirName:"api/classes",slug:"/api/classes/FindOptions",permalink:"/docs/api/classes/FindOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"FindOptions",title:"Class: FindOptions",sidebar_label:"FindOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"FindByIdOptions",permalink:"/docs/api/classes/FindByIdOptions"},next:{title:"IOttomanType",permalink:"/docs/api/classes/IOttomanType"}},r={},d=[{value:"Implements",id:"implements",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"consistency",id:"consistency",level:3},{value:"Implementation of",id:"implementation-of",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"ignoreCase",id:"ignorecase",level:3},{value:"Implementation of",id:"implementation-of-1",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"lean",id:"lean",level:3},{value:"Implementation of",id:"implementation-of-2",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"limit",id:"limit",level:3},{value:"Implementation of",id:"implementation-of-3",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"noCollection",id:"nocollection",level:3},{value:"Implementation of",id:"implementation-of-4",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"populate",id:"populate",level:3},{value:"Implementation of",id:"implementation-of-5",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"populateMaxDeep",id:"populatemaxdeep",level:3},{value:"Implementation of",id:"implementation-of-6",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"select",id:"select",level:3},{value:"Implementation of",id:"implementation-of-7",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"skip",id:"skip",level:3},{value:"Implementation of",id:"implementation-of-8",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"sort",id:"sort",level:3},{value:"Implementation of",id:"implementation-of-9",level:4},{value:"Defined in",id:"defined-in-11",level:4}],s={toc:d};function m(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,i.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"implements"},"Implements"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"IFindOptions"))),(0,o.kt)("h2",{id:"constructors"},"Constructors"),(0,o.kt)("h3",{id:"constructor"},"constructor"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("strong",{parentName:"p"},"new FindOptions"),"(",(0,o.kt)("inlineCode",{parentName:"p"},"data"),")"),(0,o.kt)("h4",{id:"parameters"},"Parameters"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,o.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:"left"},(0,o.kt)("inlineCode",{parentName:"td"},"data")),(0,o.kt)("td",{parentName:"tr",align:"left"},(0,o.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,o.kt)("inlineCode",{parentName:"a"},"FindOptions")))))),(0,o.kt)("h4",{id:"defined-in"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L25"},"handler/find/find-options.ts:25")),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"consistency"},"consistency"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"consistency"),": ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/enums/SearchConsistency"},(0,o.kt)("inlineCode",{parentName:"a"},"SearchConsistency"))),(0,o.kt)("h4",{id:"implementation-of"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.consistency"),(0,o.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L12"},"handler/find/find-options.ts:12")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,o.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,o.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L24"},"handler/find/find-options.ts:24")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"ignorecase"},"ignoreCase"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"ignoreCase"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("h4",{id:"implementation-of-1"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.ignoreCase"),(0,o.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L23"},"handler/find/find-options.ts:23")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"lean"},"lean"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"lean"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Documents returned from queries with the ",(0,o.kt)("inlineCode",{parentName:"p"},"lean")," option enabled are plain javascript objects, not Ottoman Documents. They have no save methods, hooks or other Ottoman Document's features."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"const document = await UserModel.findById(id, { lean: true });\ndocument instanceof Document; // false\n")),(0,o.kt)("h4",{id:"implementation-of-2"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.lean"),(0,o.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L22"},"handler/find/find-options.ts:22")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"limit"},"limit"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"limit"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("h4",{id:"implementation-of-3"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.limit"),(0,o.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L7"},"handler/find/find-options.ts:7")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"nocollection"},"noCollection"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"noCollection"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("h4",{id:"implementation-of-4"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.noCollection"),(0,o.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L13"},"handler/find/find-options.ts:13")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"populate"},"populate"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"populate"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"PopulateFieldsType")),(0,o.kt)("h4",{id:"implementation-of-5"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.populate"),(0,o.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L9"},"handler/find/find-options.ts:9")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"populatemaxdeep"},"populateMaxDeep"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"populateMaxDeep"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("h4",{id:"implementation-of-6"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.populateMaxDeep"),(0,o.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L10"},"handler/find/find-options.ts:10")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"select"},"select"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"select"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,o.kt)("inlineCode",{parentName:"p"},"string"),"[] ","|"," ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,o.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,o.kt)("h4",{id:"implementation-of-7"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.select"),(0,o.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L11"},"handler/find/find-options.ts:11")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"skip"},"skip"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"skip"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("h4",{id:"implementation-of-8"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.skip"),(0,o.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L6"},"handler/find/find-options.ts:6")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"sort"},"sort"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"sort"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,o.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,o.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,o.kt)("h4",{id:"implementation-of-9"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.sort"),(0,o.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L8"},"handler/find/find-options.ts:8")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2750fe84.a44de459.js b/assets/js/2750fe84.a44de459.js new file mode 100644 index 00000000..a66d157c --- /dev/null +++ b/assets/js/2750fe84.a44de459.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7453],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>c});var i=t(7294);function o(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function l(e){for(var n=1;n=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var r=i.createContext({}),d=function(e){var n=i.useContext(r),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},s=function(e){var n=d(e.components);return i.createElement(r.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},f=i.forwardRef((function(e,n){var t=e.components,o=e.mdxType,a=e.originalType,r=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),f=d(t),c=o,u=f["".concat(r,".").concat(c)]||f[c]||m[c]||a;return t?i.createElement(u,l(l({ref:n},s),{},{components:t})):i.createElement(u,l({ref:n},s))}));function c(e,n){var t=arguments,o=n&&n.mdxType;if("string"==typeof e||o){var a=t.length,l=new Array(a);l[0]=f;var p={};for(var r in n)hasOwnProperty.call(n,r)&&(p[r]=n[r]);p.originalType=e,p.mdxType="string"==typeof e?e:o,l[1]=p;for(var d=2;d{t.r(n),t.d(n,{assets:()=>r,contentTitle:()=>l,default:()=>m,frontMatter:()=>a,metadata:()=>p,toc:()=>d});var i=t(7462),o=(t(7294),t(3905));const a={id:"FindOptions",title:"Class: FindOptions",sidebar_label:"FindOptions",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/FindOptions",id:"api/classes/FindOptions",title:"Class: FindOptions",description:"Implements",source:"@site/docs/api/classes/FindOptions.md",sourceDirName:"api/classes",slug:"/api/classes/FindOptions",permalink:"/docs/api/classes/FindOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"FindOptions",title:"Class: FindOptions",sidebar_label:"FindOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"FindByIdOptions",permalink:"/docs/api/classes/FindByIdOptions"},next:{title:"IOttomanType",permalink:"/docs/api/classes/IOttomanType"}},r={},d=[{value:"Implements",id:"implements",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"consistency",id:"consistency",level:3},{value:"Implementation of",id:"implementation-of",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"ignoreCase",id:"ignorecase",level:3},{value:"Implementation of",id:"implementation-of-1",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"lean",id:"lean",level:3},{value:"Implementation of",id:"implementation-of-2",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"limit",id:"limit",level:3},{value:"Implementation of",id:"implementation-of-3",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"noCollection",id:"nocollection",level:3},{value:"Implementation of",id:"implementation-of-4",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"populate",id:"populate",level:3},{value:"Implementation of",id:"implementation-of-5",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"populateMaxDeep",id:"populatemaxdeep",level:3},{value:"Implementation of",id:"implementation-of-6",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"select",id:"select",level:3},{value:"Implementation of",id:"implementation-of-7",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"skip",id:"skip",level:3},{value:"Implementation of",id:"implementation-of-8",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"sort",id:"sort",level:3},{value:"Implementation of",id:"implementation-of-9",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"transactionContext",id:"transactioncontext",level:3},{value:"Defined in",id:"defined-in-12",level:4}],s={toc:d};function m(e){let{components:n,...t}=e;return(0,o.kt)("wrapper",(0,i.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"implements"},"Implements"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"IFindOptions"))),(0,o.kt)("h2",{id:"constructors"},"Constructors"),(0,o.kt)("h3",{id:"constructor"},"constructor"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("strong",{parentName:"p"},"new FindOptions"),"(",(0,o.kt)("inlineCode",{parentName:"p"},"data"),")"),(0,o.kt)("h4",{id:"parameters"},"Parameters"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,o.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:"left"},(0,o.kt)("inlineCode",{parentName:"td"},"data")),(0,o.kt)("td",{parentName:"tr",align:"left"},(0,o.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,o.kt)("inlineCode",{parentName:"a"},"FindOptions")))))),(0,o.kt)("h4",{id:"defined-in"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L27"},"handler/find/find-options.ts:27")),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"consistency"},"consistency"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"consistency"),": ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/enums/SearchConsistency"},(0,o.kt)("inlineCode",{parentName:"a"},"SearchConsistency"))),(0,o.kt)("h4",{id:"implementation-of"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.consistency"),(0,o.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L13"},"handler/find/find-options.ts:13")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,o.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,o.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L25"},"handler/find/find-options.ts:25")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"ignorecase"},"ignoreCase"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"ignoreCase"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("h4",{id:"implementation-of-1"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.ignoreCase"),(0,o.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L24"},"handler/find/find-options.ts:24")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"lean"},"lean"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"lean"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("p",null,"Documents returned from queries with the ",(0,o.kt)("inlineCode",{parentName:"p"},"lean")," option enabled are plain javascript objects, not Ottoman Documents. They have no save methods, hooks or other Ottoman Document's features."),(0,o.kt)("p",null,(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"const document = await UserModel.findById(id, { lean: true });\ndocument instanceof Document; // false\n")),(0,o.kt)("h4",{id:"implementation-of-2"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.lean"),(0,o.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L23"},"handler/find/find-options.ts:23")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"limit"},"limit"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"limit"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("h4",{id:"implementation-of-3"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.limit"),(0,o.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L8"},"handler/find/find-options.ts:8")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"nocollection"},"noCollection"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"noCollection"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")),(0,o.kt)("h4",{id:"implementation-of-4"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.noCollection"),(0,o.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L14"},"handler/find/find-options.ts:14")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"populate"},"populate"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"populate"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"PopulateFieldsType")),(0,o.kt)("h4",{id:"implementation-of-5"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.populate"),(0,o.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L10"},"handler/find/find-options.ts:10")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"populatemaxdeep"},"populateMaxDeep"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"populateMaxDeep"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("h4",{id:"implementation-of-6"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.populateMaxDeep"),(0,o.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L11"},"handler/find/find-options.ts:11")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"select"},"select"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"select"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,o.kt)("inlineCode",{parentName:"p"},"string"),"[] ","|"," ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,o.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,o.kt)("h4",{id:"implementation-of-7"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.select"),(0,o.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L12"},"handler/find/find-options.ts:12")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"skip"},"skip"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"skip"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("h4",{id:"implementation-of-8"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.skip"),(0,o.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L7"},"handler/find/find-options.ts:7")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"sort"},"sort"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"sort"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,o.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,o.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,o.kt)("h4",{id:"implementation-of-9"},"Implementation of"),(0,o.kt)("p",null,"IFindOptions.sort"),(0,o.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L9"},"handler/find/find-options.ts:9")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"transactioncontext"},"transactionContext"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"transactionContext"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"TransactionAttemptContext")),(0,o.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L26"},"handler/find/find-options.ts:26")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/2cc19b28.85a359d2.js b/assets/js/2cc19b28.85a359d2.js new file mode 100644 index 00000000..cb908a9d --- /dev/null +++ b/assets/js/2cc19b28.85a359d2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[2428],{3905:(t,e,n)=>{n.d(e,{Zo:()=>d,kt:()=>m});var a=n(7294);function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function i(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);e&&(a=a.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,a)}return n}function r(t){for(var e=1;e=0||(o[n]=t[n]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(t,n)&&(o[n]=t[n])}return o}var c=a.createContext({}),l=function(t){var e=a.useContext(c),n=e;return t&&(n="function"==typeof t?t(e):r(r({},e),t)),n},d=function(t){var e=l(t.components);return a.createElement(c.Provider,{value:e},t.children)},p={inlineCode:"code",wrapper:function(t){var e=t.children;return a.createElement(a.Fragment,{},e)}},u=a.forwardRef((function(t,e){var n=t.components,o=t.mdxType,i=t.originalType,c=t.parentName,d=s(t,["components","mdxType","originalType","parentName"]),u=l(n),m=o,h=u["".concat(c,".").concat(m)]||u[m]||p[m]||i;return n?a.createElement(h,r(r({ref:e},d),{},{components:n})):a.createElement(h,r({ref:e},d))}));function m(t,e){var n=arguments,o=e&&e.mdxType;if("string"==typeof t||o){var i=n.length,r=new Array(i);r[0]=u;var s={};for(var c in e)hasOwnProperty.call(e,c)&&(s[c]=e[c]);s.originalType=t,s.mdxType="string"==typeof t?t:o,r[1]=s;for(var l=2;l{n.r(e),n.d(e,{assets:()=>c,contentTitle:()=>r,default:()=>p,frontMatter:()=>i,metadata:()=>s,toc:()=>l});var a=n(7462),o=(n(7294),n(3905));const i={sidebar_position:0,title:"Transactions"},r=void 0,s={unversionedId:"advanced/transactions",id:"advanced/transactions",title:"Transactions",description:"A practical guide on using Couchbase Distributed ACID transactions in Ottoman.",source:"@site/docs/advanced/transactions.md",sourceDirName:"advanced",slug:"/advanced/transactions",permalink:"/docs/advanced/transactions",draft:!1,tags:[],version:"current",sidebarPosition:0,frontMatter:{sidebar_position:0,title:"Transactions"},sidebar:"tutorialSidebar",previous:{title:"Full Text Search",permalink:"/docs/advanced/fts"},next:{title:"How Ottoman Works",permalink:"/docs/advanced/how-ottoman-works"}},c={},l=[{value:"Creating a Transaction",id:"creating-a-transaction",level:2},{value:"Transaction Syntax",id:"transaction-syntax",level:3},{value:"Handle Error",id:"handle-error",level:3},{value:"Concurrent Operations",id:"concurrent-operations",level:3},{value:"Non-Transactional Writes",id:"non-transactional-writes",level:3},{value:"Configuration",id:"configuration",level:3},{value:"Ways of usage",id:"ways-of-usage",level:3},{value:"Examples",id:"examples",level:3},{value:"Save and retrieve a document inside a transaction, then check it was committed.",id:"save-and-retrieve-a-document-inside-a-transaction-then-check-it-was-committed",level:4},{value:"Bulk operations",id:"bulk-operations",level:4},{value:"Transactions with RefDoc Indexes",id:"transactions-with-refdoc-indexes",level:3},{value:"Additional Resources",id:"additional-resources",level:3}],d={toc:l};function p(t){let{components:e,...n}=t;return(0,o.kt)("wrapper",(0,a.Z)({},d,n,{components:e,mdxType:"MDXLayout"}),(0,o.kt)("p",null,"A practical guide on using Couchbase Distributed ACID transactions in Ottoman."),(0,o.kt)("p",null,"This guide will show you examples of how to perform multi-document ACID (atomic, consistent, isolated, and durable)\ndatabase transactions within your application."),(0,o.kt)("p",null,"Refer to the ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/nodejs-sdk/current/concept-docs/transactions.html"},"Transaction Concepts")," concept page for a high-level overview."),(0,o.kt)("admonition",{title:"Info",type:"info"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("strong",{parentName:"p"},"Notice:")," Transactions support was added in ottoman version ",(0,o.kt)("inlineCode",{parentName:"p"},"2.5.0"),". Please update to ",(0,o.kt)("inlineCode",{parentName:"p"},"2.5.0")," or later to use transactions."),(0,o.kt)("p",{parentName:"admonition"},"Ottoman's transactions implementation is intuitive and simple. If you already know how to use Ottoman, you can start working with transactions in no time."),(0,o.kt)("p",{parentName:"admonition"},"If not, please check the basics:"),(0,o.kt)("ul",{parentName:"admonition"},(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/basic/ottoman"},"Ottoman")," object"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/basic/schema"},"Schema")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/basic/model"},"Model")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/basic/document"},"Document")))),(0,o.kt)("h2",{id:"creating-a-transaction"},"Creating a Transaction"),(0,o.kt)("p",null,"To create a transaction, an application must supply its logic inside an arrow function,\nincluding any conditional logic required. Once the arrow function has successfully run to completion,\nthe transaction will be automatically committed.\nIf at any point an error occurs, the transaction will rollback and the arrow function may run again."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"}," const schema = new Schema({ name: String, age: Number });\n const Swan = model('Swan', schema);\n await start();\n try {\n await otttoman.$transactions(async (ctx: TransactionAttemptContext) => {\n const odette = new Swan({ name: 'Odette', age: 30 });\n await odette.save(false, { transactionContext: ctx });\n // check the document was created in the transaction context\n const doc = await Swan.findById(odette.id, { transactionContext: ctx });\n console.log(doc);\n });\n } catch (error) {\n if (error instanceof TransactionFailedError) {\n console.error('Transaction did not reach commit point', error)\n }\n\n if (error instanceof TransactionCommitAmbiguousError) {\n console.error('Transaction possibly committed', error)\n }\n }\n // check the document was successfully committed\n const doc = await Swan.findById(odette.id);\n console.log(doc)\n")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"$transaction")," arrow function gets passed a ",(0,o.kt)("inlineCode",{parentName:"p"},"TransactionAttemptContext")," object--generally referred to as ",(0,o.kt)("inlineCode",{parentName:"p"},"ctx")," in these examples.\nSince the arrow function could be rerun multiple times, it is important that it does not contain any side effects.\nIn particular, you should never perform regular operations on a Collection, such as ",(0,o.kt)("inlineCode",{parentName:"p"},"create()")," without using the ",(0,o.kt)("inlineCode",{parentName:"p"},"ctx"),", inside the arrow function.\nSuch operations may be performed multiple times, and will not be performed transactionally.\nInstead, you should perform these operations by using the ",(0,o.kt)("inlineCode",{parentName:"p"},"{ transactionContext: ctx }")," to pass the Transaction Context."),(0,o.kt)("p",null,"In the event that a transaction fails, your application could run into the following errors:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"TransactionCommitAmbiguousError")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"TransactionFailedError"))),(0,o.kt)("p",null,"Refer to ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/nodejs-sdk/current/concept-docs/transactions-error-handling.html#transaction_errors"},"Error Handling")," for more details on these."),(0,o.kt)("p",null,"Methods that currently support transaction context:"),(0,o.kt)("p",null,"Ottoman:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"query"))),(0,o.kt)("p",null,"Model:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"count")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"find")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"findById")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"findOne")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"create")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"createMany")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"updateById")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"replaceById")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"updateMany")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"removeById")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"removeMany")," "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"findOneAndUpdate"))),(0,o.kt)("p",null,"Document:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"save")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"remove")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"populate"))),(0,o.kt)("h3",{id:"transaction-syntax"},"Transaction Syntax"),(0,o.kt)("p",null,"The syntax is pretty simple, just need to define the function to be run by ",(0,o.kt)("inlineCode",{parentName:"p"},"$transaction"),",\nthen you only need to use the ",(0,o.kt)("inlineCode",{parentName:"p"},"ctx")," parameter as an option for the operations inside the ",(0,o.kt)("inlineCode",{parentName:"p"},"$transaction")," function."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"await otttoman.$transactions(async (ctx: TransactionAttemptContext) => {\n const odette = Swan.create({ name: 'Odette', age: 30 }, { transactionContext: ctx });\n})\n")),(0,o.kt)("admonition",{title:"Tips",type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"The only change you need to add is always to pass the ",(0,o.kt)("inlineCode",{parentName:"p"},"ctx")," in the option ",(0,o.kt)("inlineCode",{parentName:"p"},"transactionContext")," inside ",(0,o.kt)("inlineCode",{parentName:"p"},"$transaction")," function,\nthis way the operation will know you intend to use it as a transaction, use it as a rule of thumbs up and you will be fine.")),(0,o.kt)("admonition",{title:"Pitfall",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"The ",(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("inlineCode",{parentName:"strong"},"{ transactionContext: ctx }")," option ",(0,o.kt)("em",{parentName:"strong"},"must")," be passed as a parameter when inside of a ",(0,o.kt)("inlineCode",{parentName:"strong"},"$transaction")," function"),". Not passing this context will lead to unexpected results, and operations will not function as a transaction."),(0,o.kt)("p",{parentName:"admonition"},"Keep a sharp eye on it!")),(0,o.kt)("h3",{id:"handle-error"},"Handle Error"),(0,o.kt)("p",null,"While creating a transaction you always should wrap it inside a ",(0,o.kt)("inlineCode",{parentName:"p"},"try catch")," block and handle the exceptions."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"try {\n await otttoman.$transactions(async (ctx: TransactionAttemptContext) => {\n const odette = Swan.create({ name: 'Odette', age: 30 }, { transactionContext: ctx });\n });\n} catch (error) {\n if (error instanceof TransactionFailedError) {\n console.error('Transaction did not reach commit point', error)\n }\n\n if (error instanceof TransactionCommitAmbiguousError) {\n console.error('Transaction possibly committed', error)\n }\n}\n")),(0,o.kt)("h3",{id:"concurrent-operations"},"Concurrent Operations"),(0,o.kt)("p",null,"The API allows operations to be performed concurrently inside a transaction, which can assist performance.\nThere are two rules the application needs to follow:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"The first mutation must be performed alone, in serial. This is because the first mutation also triggers the creation of metadata for the transaction."),(0,o.kt)("li",{parentName:"ul"},"All concurrent operations must be allowed to complete fully, so the transaction can track which operations need to be rolled back in the event of failure. This means the application must 'swallow' the error, but record that an error occurred, and then at the end of the concurrent operations, if an error occurred, throw an error to cause the transaction to retry.")),(0,o.kt)("admonition",{title:"Note: Query Concurrency",type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Only one query statement will be performed by the Query service at a time. Non-blocking mechanisms can be used to perform multiple concurrent query statements, but this may result internally in some added network traffic due to retries, and is unlikely to provide any increased performance.")),(0,o.kt)("h3",{id:"non-transactional-writes"},"Non-Transactional Writes"),(0,o.kt)("p",null,"To ensure key-value performance is not compromised, and to avoid conflicting writes, applications should never perform non-transactional writes concurrently with transactional ones, on the same document."),(0,o.kt)("p",null,"See ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/nodejs-sdk/current/concept-docs/transactions.html#concurrency-with-non-transactional-writes"},"Concurrency with Non-Transactional Writes")," to learn more."),(0,o.kt)("h3",{id:"configuration"},"Configuration"),(0,o.kt)("p",null,"The default configuration should be appropriate for most use cases.\nTransactions can optionally be globally configured when configuring the Cluster.\nFor example, if you want to change the level of durability which that be attained,\nthis can be configured as part of the connect options:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { Ottoman } from 'ottoman';\n\nconst ottoman = new Ottoman();\n\nconst main = async () => {\n await ottoman.connect({\n connectionString: 'couchbase://localhost',\n bucketName: 'travel-sample',\n username: 'admin',\n password: 'password',\n transactions: {\n durabilityLevel: DurabilityLevel.PersistToMajority,\n },\n });\n}\n\nmain();\n")),(0,o.kt)("p",null,"The default configuration will perform all writes with the durability setting ",(0,o.kt)("inlineCode",{parentName:"p"},"Majority"),",\nensuring that each write is available in-memory on the majority of replicas before the transaction continues.\nThere are two higher durability settings available that will additionally wait for all mutations\nto be written to physical storage on either the active or the majority of replicas,\nbefore continuing. This further increases safety, at the cost of additional latency."),(0,o.kt)("admonition",{title:"Caution",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"A level of ",(0,o.kt)("inlineCode",{parentName:"p"},"None")," is present but its use is discouraged and unsupported.\nIf durability is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"None"),", then ACID compliance is not guaranteed.")),(0,o.kt)("h3",{id:"ways-of-usage"},"Ways of usage"),(0,o.kt)("p",null,"Inside the ",(0,o.kt)("inlineCode",{parentName:"p"},"$transaction")," function you can do almost everything you can do with Ottoman, for instance:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"K/V")," Operations"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"N1QL")," queries"),(0,o.kt)("li",{parentName:"ul"},"Combinations between ",(0,o.kt)("inlineCode",{parentName:"li"},"K/V")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"N1QL"))),(0,o.kt)("h3",{id:"examples"},"Examples"),(0,o.kt)("h4",{id:"save-and-retrieve-a-document-inside-a-transaction-then-check-it-was-committed"},"Save and retrieve a document inside a transaction, then check it was committed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const schema = new Schema({ name: String, age: Number });\nconst Swan = model('Swan', schema);\nawait start();\ntry {\n await otttoman.$transactions(async (ctx: TransactionAttemptContext) => {\n const name = `Odette`;\n const odette = new Swan({ name, age: 30 });\n await odette.save(false, { transactionContext: ctx });\n // check the document was created in the transaction context\n const list = await Swan.find({ name: 'Odette' }, { transactionContext: ctx });\n });\n} catch (e) {\n // Error handling logic goes here.\n}\n// check the document was successfully committed\nconst list = await Swan.find({ name: 'Odette' }, { consistency: SearchConsistency.LOCAL });\n")),(0,o.kt)("h4",{id:"bulk-operations"},"Bulk operations"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const schema = new Schema({ name: String, age: Number });\nconst Duck = model('Duck', schema);\nawait start();\ntry {\n await otttoman.$transactions(async (ctx: TransactionAttemptContext) => {\n const daisy = `Daisy`;\n const donald = `Donald`;\n const daffy = `Daffy`;\n // create 3 documents in the current context\n await Duck.createMany(\n [\n { name: daffy, age: 84 },\n { name: donald, age: 84 },\n { name: daisy, age: 84 },\n ],\n { transactionContext: ctx },\n );\n \n // execute a count query to check the 3 documents were created in the context\n const duckCount = await Duck.count({}, { transactionContext: ctx });\n console.log(duckCount)\n \n // rename the documents with age = 84 to Daisy\n await Duck.updateMany({ age: 84 }, { name: daisy }, { transactionContext: ctx });\n \n // query the list of documents to check they were updated as expected\n const list = await Duck.find({ age: 84 }, { transactionContext: ctx });\n console.log(list.rows)\n });\n} catch (e) {\n // Error handling logic goes here.\n}\n\n// query the list of documents to check they were updated and committed\nconst list = await Duck.find({ age: 84 }, { consistency: SearchConsistency.LOCAL });\nconsole.log(list.rows)\n")),(0,o.kt)("h3",{id:"transactions-with-refdoc-indexes"},"Transactions with RefDoc Indexes"),(0,o.kt)("admonition",{title:"Pitfall",type:"danger"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("strong",{parentName:"p"},"RefDoc Indexes are not currently supported with transactions.")," Avoid accessing or mutating schemas that are indexed with a RefDoc index within a transaction. Doing so will lead to unexpected results, and operations will not function as a transaction.")),(0,o.kt)("p",null,"Any schema in your Ottoman project that is indexed with a ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema#refdoc"},"RefDoc index")," should ",(0,o.kt)("strong",{parentName:"p"},"not be accessed or mutated within a transaction.")," For example, if the ",(0,o.kt)("inlineCode",{parentName:"p"},"Swan")," schema is indexed with a RefDoc index, the following code will work, but the transaction will not be atomic:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"await otttoman.$transactions(async (ctx: TransactionAttemptContext) => {\n const odette = Swan.create({ name: 'Odette', age: 30 }, { transactionContext: ctx });\n})\n")),(0,o.kt)("p",null,"It is acceptable to access ",(0,o.kt)("em",{parentName:"p"},"other")," schemas that are ",(0,o.kt)("strong",{parentName:"p"},"not")," indexed with a RefDoc index within a transaction. Ottoman will warn you if your project has ",(0,o.kt)("strong",{parentName:"p"},"any")," refdoc indexes when you attempt to use transactions, but it is up to you to ensure that you do not access or mutate these particular schemas within a transaction. "),(0,o.kt)("h3",{id:"additional-resources"},"Additional Resources"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Check the Couchbase Node.JS SDK ",(0,o.kt)("a",{parentName:"li",href:"https://docs.couchbase.com/nodejs-sdk/current/howtos/distributed-acid-transactions-from-the-sdk.html"},"transaction documentation"),"."),(0,o.kt)("li",{parentName:"ul"},"Learn more about ",(0,o.kt)("a",{parentName:"li",href:"https://docs.couchbase.com/nodejs-sdk/current/concept-docs/transactions.html"},"Distributed ACID Transactions"),"."),(0,o.kt)("li",{parentName:"ul"},"Check out the SDK ",(0,o.kt)("a",{parentName:"li",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/index.html"},"API Reference"),".")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/308cf47a.1d88f018.js b/assets/js/308cf47a.9a87db4b.js similarity index 95% rename from assets/js/308cf47a.1d88f018.js rename to assets/js/308cf47a.9a87db4b.js index b2102294..dca3aec0 100644 --- a/assets/js/308cf47a.1d88f018.js +++ b/assets/js/308cf47a.9a87db4b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[4447],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),u=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=u(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=u(n),m=i,f=d["".concat(s,".").concat(m)]||d[m]||p[m]||a;return n?r.createElement(f,o(o({ref:t},c),{},{components:n})):r.createElement(f,o({ref:t},c))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>a,metadata:()=>l,toc:()=>u});var r=n(7462),i=(n(7294),n(3905));const a={id:"VALIDATION_STRATEGY",title:"Enumeration: VALIDATION_STRATEGY",sidebar_label:"VALIDATION_STRATEGY",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/enums/VALIDATION_STRATEGY",id:"api/enums/VALIDATION_STRATEGY",title:"Enumeration: VALIDATION_STRATEGY",description:"Hooks available",source:"@site/docs/api/enums/VALIDATION_STRATEGY.md",sourceDirName:"api/enums",slug:"/api/enums/VALIDATION_STRATEGY",permalink:"/docs/api/enums/VALIDATION_STRATEGY",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"VALIDATION_STRATEGY",title:"Enumeration: VALIDATION_STRATEGY",sidebar_label:"VALIDATION_STRATEGY",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"SearchConsistency",permalink:"/docs/api/enums/SearchConsistency"},next:{title:"ArrayType",permalink:"/docs/api/classes/ArrayType"}},s={},u=[{value:"Enumeration Members",id:"enumeration-members",level:2},{value:"EQUAL",id:"equal",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"STRICT",id:"strict",level:3},{value:"Defined in",id:"defined-in-1",level:4}],c={toc:u};function p(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Hooks available\n'strict' | 'equal'"),(0,i.kt)("h2",{id:"enumeration-members"},"Enumeration Members"),(0,i.kt)("h3",{id:"equal"},"EQUAL"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"EQUAL")," = ",(0,i.kt)("inlineCode",{parentName:"p"},'"equal"')),(0,i.kt)("h4",{id:"defined-in"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/validation.strategy.ts#L7"},"utils/validation.strategy.ts:7")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"strict"},"STRICT"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"STRICT")," = ",(0,i.kt)("inlineCode",{parentName:"p"},'"strict"')),(0,i.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/validation.strategy.ts#L6"},"utils/validation.strategy.ts:6")))}p.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[4447],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>m});var r=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var s=r.createContext({}),u=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=u(e.components);return r.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=u(n),m=i,f=d["".concat(s,".").concat(m)]||d[m]||p[m]||a;return n?r.createElement(f,o(o({ref:t},c),{},{components:n})):r.createElement(f,o({ref:t},c))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,o=new Array(a);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:i,o[1]=l;for(var u=2;u{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>p,frontMatter:()=>a,metadata:()=>l,toc:()=>u});var r=n(7462),i=(n(7294),n(3905));const a={id:"VALIDATION_STRATEGY",title:"Enumeration: VALIDATION_STRATEGY",sidebar_label:"VALIDATION_STRATEGY",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/enums/VALIDATION_STRATEGY",id:"api/enums/VALIDATION_STRATEGY",title:"Enumeration: VALIDATION_STRATEGY",description:"Hooks available",source:"@site/docs/api/enums/VALIDATION_STRATEGY.md",sourceDirName:"api/enums",slug:"/api/enums/VALIDATION_STRATEGY",permalink:"/docs/api/enums/VALIDATION_STRATEGY",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"VALIDATION_STRATEGY",title:"Enumeration: VALIDATION_STRATEGY",sidebar_label:"VALIDATION_STRATEGY",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"SearchConsistency",permalink:"/docs/api/enums/SearchConsistency"},next:{title:"ArrayType",permalink:"/docs/api/classes/ArrayType"}},s={},u=[{value:"Enumeration Members",id:"enumeration-members",level:2},{value:"EQUAL",id:"equal",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"STRICT",id:"strict",level:3},{value:"Defined in",id:"defined-in-1",level:4}],c={toc:u};function p(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("p",null,"Hooks available\n'strict' | 'equal'"),(0,i.kt)("h2",{id:"enumeration-members"},"Enumeration Members"),(0,i.kt)("h3",{id:"equal"},"EQUAL"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"EQUAL")," = ",(0,i.kt)("inlineCode",{parentName:"p"},'"equal"')),(0,i.kt)("h4",{id:"defined-in"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/validation.strategy.ts#L7"},"utils/validation.strategy.ts:7")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"strict"},"STRICT"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("strong",{parentName:"p"},"STRICT")," = ",(0,i.kt)("inlineCode",{parentName:"p"},'"strict"')),(0,i.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/validation.strategy.ts#L6"},"utils/validation.strategy.ts:6")))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/336d0c37.a96c7f52.js b/assets/js/336d0c37.0c1d11b6.js similarity index 82% rename from assets/js/336d0c37.a96c7f52.js rename to assets/js/336d0c37.0c1d11b6.js index 36884ce6..751c09a0 100644 --- a/assets/js/336d0c37.a96c7f52.js +++ b/assets/js/336d0c37.0c1d11b6.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[4397],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>c});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),i=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=i(e.components);return a.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),u=i(n),c=r,k=u["".concat(p,".").concat(c)]||u[c]||m[c]||l;return n?a.createElement(k,o(o({ref:t},s),{},{components:n})):a.createElement(k,o({ref:t},s))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=u;var d={};for(var p in t)hasOwnProperty.call(t,p)&&(d[p]=t[p]);d.originalType=e,d.mdxType="string"==typeof e?e:r,o[1]=d;for(var i=2;i{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>i});var a=n(7462),r=(n(7294),n(3905));const l={id:"Model",title:"Class: Model",sidebar_label:"Model",sidebar_position:0,custom_edit_url:null},o=void 0,d={unversionedId:"api/classes/Model",id:"api/classes/Model",title:"Class: Model",description:"Document class represents a database document and provides useful methods to work with.",source:"@site/docs/api/classes/Model.md",sourceDirName:"api/classes",slug:"/api/classes/Model",permalink:"/docs/api/classes/Model",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Model",title:"Class: Model",sidebar_label:"Model",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"MixedType",permalink:"/docs/api/classes/MixedType"},next:{title:"MultipleQueryTypesException",permalink:"/docs/api/classes/MultipleQueryTypesException"}},p={},i=[{value:"Type parameters",id:"type-parameters",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Accessors",id:"accessors",level:2},{value:"$isNew",id:"isnew",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Methods",id:"methods",level:2},{value:"_applyData",id:"_applydata",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"_depopulate",id:"_depopulate",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"_getId",id:"_getid",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"_getIdField",id:"_getidfield",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"_populate",id:"_populate",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"_populated",id:"_populated",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"_validate",id:"_validate",level:3},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"remove",id:"remove",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"save",id:"save",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"toJSON",id:"tojson",level:3},{value:"Returns",id:"returns-10",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"toObject",id:"toobject",level:3},{value:"Returns",id:"returns-11",level:4},{value:"Inherited from",id:"inherited-from-11",level:4},{value:"Defined in",id:"defined-in-11",level:4}],s={toc:i};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Document class represents a database document and provides useful methods to work with."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'import { connect, model } from "ottoman";\nconnect("couchbase://localhost/travel-sample@admin:password");\n\n// Create an `User` model\nconst User = model(\'User\', { name: String });\n\n// Create a document from the `User` Model\nconst jane = new User({ name: "Jane Doe" })\n')),(0,r.kt)("h2",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Model"))))),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"isnew"},"$isNew"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"$isNew"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Boolean flag specifying if the document is new."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\n\n// Create model\nconst Card = model('Card', CardSchema);\n\n// Create document\nconst myCard = new Card({ cardNumber: '4321 4321 4321 4321', zipCode: '43210' });\nmyCard.$isNew; // true\n\n// Save document\nconst myCardSaved = await myCard.save();\nmyCardSaved.$isNew; // false\n")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,"Document.$isNew"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L612"},"model/document.ts:612")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_applydata"},"_","applyData"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_applyData"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Allows to easily apply data from an object to current document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const user = new User({ name: "John Doe" });\n\nuser._applyData({ name: "Jane Doe" });\nconsole.log(user) // { name: "Jane Doe" }\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"With strategies on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const User = model('Card', { name: { type: String, immutable: true } });\nconst user = new User({ name: 'John Doe' });\n\n // with strategy:false is like above example\n user._applyData({ name: 'Jane Doe' }, false);\n console.log(user); // { name: \"Jane Doe\" }\n\n // with strategy:true remains immutable\n user._applyData({ name: 'Jane Doe' }, true);\n console.log(user); // { name: \"John Doe\" }\n\n // trying to update it directly\n user.name = 'Jane Doe';\n console.log(user); // { name: \"John Doe\" }\n\n // with strategy:CAST_STRATEGY.THROW\n user._applyData({ name: 'Jane Doe' }, CAST_STRATEGY.THROW);\n // ImmutableError: Field 'name' is immutable and current cast strategy is set to 'throw'\n")),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ApplyStrategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_applydata"},"_applyData")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L521"},"model/document.ts:521")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_depopulate"},"_","depopulate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_depopulate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldsName"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Reverts population. Switches back document reference."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"To get in context about the Card and Issue Models ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"see the populate example."),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const card = await Card.findById(cardId);\nconsole.log(card.issues); // ['issueId']\n\nawait card._populate('issues')\nconsole.log(card.issues); // [{ id: 'issueId', title: 'Broken card' }]\n\ncard._depopulate('issues')\nconsole.log(card.issues); // ['issueId']\n")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldsName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_depopulate"},"_depopulate")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L437"},"model/document.ts:437")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_getid"},"_","getId"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_getId"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Returns id value, useful when working with dynamic ID_KEY."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"}," console.log(user._getId()); // 'userId'\n console.log(user.id); // 'userId'\n")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_getid"},"_getId")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L124"},"model/document.ts:124")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_getidfield"},"_","getIdField"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_getIdField"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Returns id key."),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_getidfield"},"_getIdField")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L131"},"model/document.ts:131")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_populate"},"_","populate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_populate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldsName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">",">"),(0,r.kt)("p",null,"Allows to load document references."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Getting context to explain populate."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"// Defining the schemas\nconst addressSchema = new Schema({\n address: String,\n});\nconst personSchema = new Schema({\n name: String,\n age: Number,\n address: { type: addressSchema, ref: 'Address' },\n});\nconst companySchema = new Schema({\n president: { type: personSchema, ref: 'Person' },\n ceo: { type: personSchema, ref: 'Person' },\n name: String,\n workers: [{ type: personSchema, ref: 'Person' }],\n});\n\n// Initializing the models\nconst Address = model('Address', addressSchema);\nconst Person = model('Person', personSchema);\nconst Company = model('Company', companySchema);\n\n// Adding some data\nconst johnAddress = await Address.create({ address: '13 Washington Square S, New York, NY 10012, USA' });\nconst john = await Person.create({ name: 'John Smith', age: 52, address: johnAddress });\n\nconst janeAddress = await Address.create({ address: '55 Clark St, Brooklyn, NY 11201, USA' });\nconst jane = await Person.create({ name: 'Jane Doe', age: 45, address: janeAddress });\n\nconst company = await Company.create({ name: 'Space X', president: john, ceo: jane });\n\n// Getting saved company data\nconst spaceX = await Company.findById(company.id);\nconsole.log(`Company: `, company);\n")),(0,r.kt)("p",null,"Will get:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Company: {\n name: 'Space X',\n president: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n ceo: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Now we will see how the _populate methods works."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate('ceo');\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n ceo: {\n name: 'Jane Doe',\n age: 45,\n address: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n _type: 'Person'\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Can also pass an array or a string separated by a comma"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate('ceo,president');\n// or\nconst result = await spaceX._populate(['ceo', 'president']);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: {\n name: 'John Smith',\n age: 52,\n address: 'bc7ea8a8-8d1c-4ab6-990c-d3a0163f7e10',\n id: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n _type: 'Person'\n },\n ceo: {\n name: 'Jane Doe',\n age: 45,\n address: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n _type: 'Person'\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"If you want to get only a portion of the object"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate({\n ceo: ['age', 'address'], // or 'age,addres'\n president: 'name',\n});\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: { name: 'John Smith' },\n ceo: { age: 45, address: '235dd441-b445-4b88-b6aa-2ce35a958a32' },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Now let's to go deeper"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate(\n {\n ceo: {\n select: 'age,id', // remember you can use ['age','address']\n populate: 'address', // will populate all the fields\n },\n president: {\n select: 'name',\n populate: {\n address: 'address', // will populate address field only\n },\n },\n },\n 2, // for populate up to the second level\n);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: {\n name: 'John Smith',\n address: { address: '13 Washington Square S, New York, NY 10012, USA' }\n },\n ceo: {\n age: 45,\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n address: {\n address: '55 Clark St, Brooklyn, NY 11201, USA',\n id: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n _type: 'Address'\n }\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Below is another way through the find functions"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await Company.findOne(\n { name: 'Space X' },\n {\n select: 'president,ceo',\n populate: {\n president: { select: 'address,id', populate: 'address' },\n ceo: { select: ['age', 'name'], populate: { address: { select: 'id' } } },\n },\n populateMaxDeep: 2,\n },\n);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n ceo: {\n age: 45,\n name: 'Jane Doe',\n address: { id: '235dd441-b445-4b88-b6aa-2ce35a958a32' }\n },\n president: {\n address: {\n address: '13 Washington Square S, New York, NY 10012, USA',\n id: 'bc7ea8a8-8d1c-4ab6-990c-d3a0163f7e10',\n _type: 'Address'\n },\n id: '50e85ac9-5b4f-4587-aeb6-b287527794c9'\n }\n}\n")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldsName?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"PopulateFieldsType"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"PopulateOptionsType"))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">",">"),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_populate"},"_populate")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L415"},"model/document.ts:415")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_populated"},"_","populated"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_populated"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldName"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Allows to know if a document field is populated."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"To get in context about the Card and Issue Models ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"see the populate example."),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const card = await Card.findById(cardId);\nconsole.log(card.issues); // ['issueId']\nconsole.log(card._populated('issues')); // false\n\nawait card._populate('issues')\nconsole.log(card.issues); // [{ id: 'issueId', title: 'Broken card' }]\nconsole.log(card._populated('issues')); // true\n")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_populated"},"_populated")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L477"},"model/document.ts:477")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_validate"},"_","validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_validate"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Runs schema validations over current document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = new User( { name: "John Doe" } );\n\ntry {\n await user._validate()\n} catch(errors) {\n console.log(errors)\n}\n')),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_validate"},"_validate")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L565"},"model/document.ts:565")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"remove"},"remove"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"remove"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Removes the document from the database."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const user = User.findById('userId')\n\nawait user.remove();\n")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object"))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#remove"},"remove")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L205"},"model/document.ts:205")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"save"},"save"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"save"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"onlyCreate?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Saves or Updates the document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = new User({ name: "John Doe" }); //user document created, it\'s not saved yet\n\nawait user.save(); // user saved into the DB\n\n// You also can force save function to only create new Documents by passing true as argument\nawait user.save(true); // ensure to execute a insert operation\n')),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"onlyCreate")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"false"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/saveOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"saveOptions"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"{}"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#save"},"save")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L148"},"model/document.ts:148")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"tojson"},"toJSON"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"toJSON"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Returns a Javascript object to be serialized to JSON"),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#tojson"},"toJSON")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L579"},"model/document.ts:579")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"toobject"},"toObject"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"toObject"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Returns a Javascript object with data"),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"inherited-from-11"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#toobject"},"toObject")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L572"},"model/document.ts:572")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[4397],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>c});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),i=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=i(e.components);return a.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=d(e,["components","mdxType","originalType","parentName"]),u=i(n),c=r,k=u["".concat(p,".").concat(c)]||u[c]||m[c]||l;return n?a.createElement(k,o(o({ref:t},s),{},{components:n})):a.createElement(k,o({ref:t},s))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=u;var d={};for(var p in t)hasOwnProperty.call(t,p)&&(d[p]=t[p]);d.originalType=e,d.mdxType="string"==typeof e?e:r,o[1]=d;for(var i=2;i{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>d,toc:()=>i});var a=n(7462),r=(n(7294),n(3905));const l={id:"Model",title:"Class: Model",sidebar_label:"Model",sidebar_position:0,custom_edit_url:null},o=void 0,d={unversionedId:"api/classes/Model",id:"api/classes/Model",title:"Class: Model",description:"Document class represents a database document and provides useful methods to work with.",source:"@site/docs/api/classes/Model.md",sourceDirName:"api/classes",slug:"/api/classes/Model",permalink:"/docs/api/classes/Model",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Model",title:"Class: Model",sidebar_label:"Model",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"MixedType",permalink:"/docs/api/classes/MixedType"},next:{title:"MultipleQueryTypesException",permalink:"/docs/api/classes/MultipleQueryTypesException"}},p={},i=[{value:"Type parameters",id:"type-parameters",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Accessors",id:"accessors",level:2},{value:"$isNew",id:"isnew",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Methods",id:"methods",level:2},{value:"_applyData",id:"_applydata",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"_depopulate",id:"_depopulate",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"_getId",id:"_getid",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"_getIdField",id:"_getidfield",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"_populate",id:"_populate",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"_populated",id:"_populated",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"_validate",id:"_validate",level:3},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"remove",id:"remove",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"save",id:"save",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"toJSON",id:"tojson",level:3},{value:"Returns",id:"returns-10",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"toObject",id:"toobject",level:3},{value:"Returns",id:"returns-11",level:4},{value:"Inherited from",id:"inherited-from-11",level:4},{value:"Defined in",id:"defined-in-11",level:4}],s={toc:i};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Document class represents a database document and provides useful methods to work with."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'import { connect, model } from "ottoman";\nconnect("couchbase://localhost/travel-sample@admin:password");\n\n// Create an `User` model\nconst User = model(\'User\', { name: String });\n\n// Create a document from the `User` Model\nconst jane = new User({ name: "Jane Doe" })\n')),(0,r.kt)("h2",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Model"))))),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"isnew"},"$isNew"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"$isNew"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Boolean flag specifying if the document is new."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\n\n// Create model\nconst Card = model('Card', CardSchema);\n\n// Create document\nconst myCard = new Card({ cardNumber: '4321 4321 4321 4321', zipCode: '43210' });\nmyCard.$isNew; // true\n\n// Save document\nconst myCardSaved = await myCard.save();\nmyCardSaved.$isNew; // false\n")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,"Document.$isNew"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L615"},"model/document.ts:615")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_applydata"},"_","applyData"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_applyData"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Allows to easily apply data from an object to current document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const user = new User({ name: "John Doe" });\n\nuser._applyData({ name: "Jane Doe" });\nconsole.log(user) // { name: "Jane Doe" }\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"With strategies on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const User = model('Card', { name: { type: String, immutable: true } });\nconst user = new User({ name: 'John Doe' });\n\n // with strategy:false is like above example\n user._applyData({ name: 'Jane Doe' }, false);\n console.log(user); // { name: \"Jane Doe\" }\n\n // with strategy:true remains immutable\n user._applyData({ name: 'Jane Doe' }, true);\n console.log(user); // { name: \"John Doe\" }\n\n // trying to update it directly\n user.name = 'Jane Doe';\n console.log(user); // { name: \"John Doe\" }\n\n // with strategy:CAST_STRATEGY.THROW\n user._applyData({ name: 'Jane Doe' }, CAST_STRATEGY.THROW);\n // ImmutableError: Field 'name' is immutable and current cast strategy is set to 'throw'\n")),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ApplyStrategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_applydata"},"_applyData")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L524"},"model/document.ts:524")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_depopulate"},"_","depopulate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_depopulate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldsName"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Reverts population. Switches back document reference."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"To get in context about the Card and Issue Models ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"see the populate example."),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const card = await Card.findById(cardId);\nconsole.log(card.issues); // ['issueId']\n\nawait card._populate('issues')\nconsole.log(card.issues); // [{ id: 'issueId', title: 'Broken card' }]\n\ncard._depopulate('issues')\nconsole.log(card.issues); // ['issueId']\n")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldsName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_depopulate"},"_depopulate")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L440"},"model/document.ts:440")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_getid"},"_","getId"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_getId"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Returns id value, useful when working with dynamic ID_KEY."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"}," console.log(user._getId()); // 'userId'\n console.log(user.id); // 'userId'\n")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_getid"},"_getId")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L124"},"model/document.ts:124")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_getidfield"},"_","getIdField"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_getIdField"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Returns id key."),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_getidfield"},"_getIdField")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L131"},"model/document.ts:131")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_populate"},"_","populate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_populate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldsName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">",">"),(0,r.kt)("p",null,"Allows to load document references."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Getting context to explain populate."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"// Defining the schemas\nconst addressSchema = new Schema({\n address: String,\n});\nconst personSchema = new Schema({\n name: String,\n age: Number,\n address: { type: addressSchema, ref: 'Address' },\n});\nconst companySchema = new Schema({\n president: { type: personSchema, ref: 'Person' },\n ceo: { type: personSchema, ref: 'Person' },\n name: String,\n workers: [{ type: personSchema, ref: 'Person' }],\n});\n\n// Initializing the models\nconst Address = model('Address', addressSchema);\nconst Person = model('Person', personSchema);\nconst Company = model('Company', companySchema);\n\n// Adding some data\nconst johnAddress = await Address.create({ address: '13 Washington Square S, New York, NY 10012, USA' });\nconst john = await Person.create({ name: 'John Smith', age: 52, address: johnAddress });\n\nconst janeAddress = await Address.create({ address: '55 Clark St, Brooklyn, NY 11201, USA' });\nconst jane = await Person.create({ name: 'Jane Doe', age: 45, address: janeAddress });\n\nconst company = await Company.create({ name: 'Space X', president: john, ceo: jane });\n\n// Getting saved company data\nconst spaceX = await Company.findById(company.id);\nconsole.log(`Company: `, company);\n")),(0,r.kt)("p",null,"Will get:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Company: {\n name: 'Space X',\n president: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n ceo: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Now we will see how the _populate methods works."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate('ceo');\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n ceo: {\n name: 'Jane Doe',\n age: 45,\n address: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n _type: 'Person'\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Can also pass an array or a string separated by a comma"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate('ceo,president');\n// or\nconst result = await spaceX._populate(['ceo', 'president']);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: {\n name: 'John Smith',\n age: 52,\n address: 'bc7ea8a8-8d1c-4ab6-990c-d3a0163f7e10',\n id: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n _type: 'Person'\n },\n ceo: {\n name: 'Jane Doe',\n age: 45,\n address: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n _type: 'Person'\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"If you want to get only a portion of the object"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate({\n ceo: ['age', 'address'], // or 'age,addres'\n president: 'name',\n});\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: { name: 'John Smith' },\n ceo: { age: 45, address: '235dd441-b445-4b88-b6aa-2ce35a958a32' },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Now let's to go deeper"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate(\n {\n ceo: {\n select: 'age,id', // remember you can use ['age','address']\n populate: 'address', // will populate all the fields\n },\n president: {\n select: 'name',\n populate: {\n address: 'address', // will populate address field only\n },\n },\n },\n 2, // for populate up to the second level\n);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: {\n name: 'John Smith',\n address: { address: '13 Washington Square S, New York, NY 10012, USA' }\n },\n ceo: {\n age: 45,\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n address: {\n address: '55 Clark St, Brooklyn, NY 11201, USA',\n id: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n _type: 'Address'\n }\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Below is another way through the find functions"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await Company.findOne(\n { name: 'Space X' },\n {\n select: 'president,ceo',\n populate: {\n president: { select: 'address,id', populate: 'address' },\n ceo: { select: ['age', 'name'], populate: { address: { select: 'id' } } },\n },\n populateMaxDeep: 2,\n },\n);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n ceo: {\n age: 45,\n name: 'Jane Doe',\n address: { id: '235dd441-b445-4b88-b6aa-2ce35a958a32' }\n },\n president: {\n address: {\n address: '13 Washington Square S, New York, NY 10012, USA',\n id: 'bc7ea8a8-8d1c-4ab6-990c-d3a0163f7e10',\n _type: 'Address'\n },\n id: '50e85ac9-5b4f-4587-aeb6-b287527794c9'\n }\n}\n")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldsName?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"PopulateFieldsType"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"PopulateOptionsType"))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">",">"),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_populate"},"_populate")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L418"},"model/document.ts:418")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_populated"},"_","populated"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_populated"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldName"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Allows to know if a document field is populated."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"To get in context about the Card and Issue Models ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"see the populate example."),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const card = await Card.findById(cardId);\nconsole.log(card.issues); // ['issueId']\nconsole.log(card._populated('issues')); // false\n\nawait card._populate('issues')\nconsole.log(card.issues); // [{ id: 'issueId', title: 'Broken card' }]\nconsole.log(card._populated('issues')); // true\n")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_populated"},"_populated")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L480"},"model/document.ts:480")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_validate"},"_","validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_validate"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Runs schema validations over current document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = new User( { name: "John Doe" } );\n\ntry {\n await user._validate()\n} catch(errors) {\n console.log(errors)\n}\n')),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#_validate"},"_validate")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L568"},"model/document.ts:568")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"remove"},"remove"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"remove"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Removes the document from the database."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const user = User.findById('userId')\n\nawait user.remove();\n")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"removeOptions"))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#remove"},"remove")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L208"},"model/document.ts:208")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"save"},"save"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"save"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"onlyCreate?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Saves or Updates the document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = new User({ name: "John Doe" }); //user document created, it\'s not saved yet\n\nawait user.save(); // user saved into the DB\n\n// You also can force save function to only create new Documents by passing true as argument\nawait user.save(true); // ensure to execute a insert operation\n')),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"onlyCreate")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"false"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/saveOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"saveOptions"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"{}"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#save"},"save")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L148"},"model/document.ts:148")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"tojson"},"toJSON"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"toJSON"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Returns a Javascript object to be serialized to JSON"),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#tojson"},"toJSON")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L582"},"model/document.ts:582")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"toobject"},"toObject"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"toObject"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Returns a Javascript object with data"),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"inherited-from-11"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},"Document"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document#toobject"},"toObject")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L575"},"model/document.ts:575")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3f30fbc6.164310fa.js b/assets/js/3f30fbc6.164310fa.js deleted file mode 100644 index 353e50f7..00000000 --- a/assets/js/3f30fbc6.164310fa.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6891],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var i=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var d=i.createContext({}),p=function(e){var t=i.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=p(e.components);return i.createElement(d.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},c=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,d=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=p(n),u=a,m=c["".concat(d,".").concat(u)]||c[u]||f[u]||r;return n?i.createElement(m,l(l({ref:t},s),{},{components:n})):i.createElement(m,l({ref:t},s))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,l=new Array(r);l[0]=c;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:a,l[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>r,metadata:()=>o,toc:()=>p});var i=n(7462),a=(n(7294),n(3905));const r={id:"UpdateManyOptions",title:"Interface: UpdateManyOptions",sidebar_label:"UpdateManyOptions",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/UpdateManyOptions",id:"api/interfaces/UpdateManyOptions",title:"Interface: UpdateManyOptions",description:"Update Many Options parameter",source:"@site/docs/api/interfaces/UpdateManyOptions.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/UpdateManyOptions",permalink:"/docs/api/interfaces/UpdateManyOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"UpdateManyOptions",title:"Interface: UpdateManyOptions",sidebar_label:"UpdateManyOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ModelOptions",permalink:"/docs/api/interfaces/ModelOptions"},next:{title:"ValidatorOption",permalink:"/docs/api/interfaces/ValidatorOption"}},d={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:"consistency",id:"consistency",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"ignoreCase",id:"ignorecase",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"lean",id:"lean",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"limit",id:"limit",level:3},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"noCollection",id:"nocollection",level:3},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"populate",id:"populate",level:3},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"populateMaxDeep",id:"populatemaxdeep",level:3},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"select",id:"select",level:3},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"skip",id:"skip",level:3},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"sort",id:"sort",level:3},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"strict",id:"strict",level:3},{value:"Inherited from",id:"inherited-from-11",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"upsert",id:"upsert",level:3},{value:"Defined in",id:"defined-in-13",level:4}],s={toc:p};function f(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Update Many Options parameter"),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"IFindOptions"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("a",{parentName:"p",href:"/docs/api/modules#mutationfunctionoptions"},(0,a.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions"))),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"UpdateManyOptions"))))),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"consistency"},"consistency"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"consistency"),": ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/enums/SearchConsistency"},(0,a.kt)("inlineCode",{parentName:"a"},"SearchConsistency"))),(0,a.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.consistency"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L39"},"handler/find/find-options.ts:39")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,a.kt)("p",null,"Default: false\nenforceRefCheck will check if the referenced document exists\nset to true: will log a warning message.\nset to 'throw': will throw an exception."),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"MutationFunctionOptions.enforceRefCheck"),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/update-many.interface.ts#L19"},"model/interfaces/update-many.interface.ts:19")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignorecase"},"ignoreCase"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"ignoreCase"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.ignoreCase"),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L42"},"handler/find/find-options.ts:42")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"lean"},"lean"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"lean"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.lean"),(0,a.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L41"},"handler/find/find-options.ts:41")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"limit"},"limit"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"limit"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.limit"),(0,a.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L34"},"handler/find/find-options.ts:34")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,a.kt)("p",null,"MutationFunctionOptions.maxExpiry"),(0,a.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/cast-strategy.ts#L52"},"utils/cast-strategy.ts:52")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"nocollection"},"noCollection"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"noCollection"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.noCollection"),(0,a.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L40"},"handler/find/find-options.ts:40")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"populate"},"populate"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"populate"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"PopulateFieldsType")),(0,a.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.populate"),(0,a.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L36"},"handler/find/find-options.ts:36")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"populatemaxdeep"},"populateMaxDeep"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"populateMaxDeep"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.populateMaxDeep"),(0,a.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L37"},"handler/find/find-options.ts:37")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"select"},"select"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"select"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[] ","|"," ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,a.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,a.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.select"),(0,a.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L38"},"handler/find/find-options.ts:38")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"skip"},"skip"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"skip"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.skip"),(0,a.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L33"},"handler/find/find-options.ts:33")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sort"},"sort"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"sort"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,a.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,a.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,a.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.sort"),(0,a.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L35"},"handler/find/find-options.ts:35")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"strict"},"strict"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"strict"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"ApplyStrategy")),(0,a.kt)("h4",{id:"inherited-from-11"},"Inherited from"),(0,a.kt)("p",null,"MutationFunctionOptions.strict"),(0,a.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/cast-strategy.ts#L51"},"utils/cast-strategy.ts:51")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"upsert"},"upsert"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"upsert"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Default: false\nif true, and no documents found, insert a new document."),(0,a.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/update-many.interface.ts#L11"},"model/interfaces/update-many.interface.ts:11")))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/3f30fbc6.dff56118.js b/assets/js/3f30fbc6.dff56118.js new file mode 100644 index 00000000..e42ba1c4 --- /dev/null +++ b/assets/js/3f30fbc6.dff56118.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6891],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>u});var i=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var d=i.createContext({}),p=function(e){var t=i.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=p(e.components);return i.createElement(d.Provider,{value:t},e.children)},f={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},c=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,d=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),c=p(n),u=a,m=c["".concat(d,".").concat(u)]||c[u]||f[u]||r;return n?i.createElement(m,o(o({ref:t},s),{},{components:n})):i.createElement(m,o({ref:t},s))}));function u(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,o=new Array(r);o[0]=c;var l={};for(var d in t)hasOwnProperty.call(t,d)&&(l[d]=t[d]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>f,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var i=n(7462),a=(n(7294),n(3905));const r={id:"UpdateManyOptions",title:"Interface: UpdateManyOptions",sidebar_label:"UpdateManyOptions",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/interfaces/UpdateManyOptions",id:"api/interfaces/UpdateManyOptions",title:"Interface: UpdateManyOptions",description:"Update Many Options parameter",source:"@site/docs/api/interfaces/UpdateManyOptions.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/UpdateManyOptions",permalink:"/docs/api/interfaces/UpdateManyOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"UpdateManyOptions",title:"Interface: UpdateManyOptions",sidebar_label:"UpdateManyOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ModelOptions",permalink:"/docs/api/interfaces/ModelOptions"},next:{title:"ValidatorOption",permalink:"/docs/api/interfaces/ValidatorOption"}},d={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:"consistency",id:"consistency",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"ignoreCase",id:"ignorecase",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"lean",id:"lean",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"limit",id:"limit",level:3},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"noCollection",id:"nocollection",level:3},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"populate",id:"populate",level:3},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"populateMaxDeep",id:"populatemaxdeep",level:3},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"select",id:"select",level:3},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"skip",id:"skip",level:3},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"sort",id:"sort",level:3},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"strict",id:"strict",level:3},{value:"Inherited from",id:"inherited-from-11",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"transactionContext",id:"transactioncontext",level:3},{value:"Inherited from",id:"inherited-from-12",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"upsert",id:"upsert",level:3},{value:"Defined in",id:"defined-in-14",level:4}],s={toc:p};function f(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Update Many Options parameter"),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"IFindOptions"))),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("a",{parentName:"p",href:"/docs/api/modules#mutationfunctionoptions"},(0,a.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions"))),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"UpdateManyOptions"))))),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"consistency"},"consistency"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"consistency"),": ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/enums/SearchConsistency"},(0,a.kt)("inlineCode",{parentName:"a"},"SearchConsistency"))),(0,a.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.consistency"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L41"},"handler/find/find-options.ts:41")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,a.kt)("p",null,"Default: false\nenforceRefCheck will check if the referenced document exists\nset to true: will log a warning message.\nset to 'throw': will throw an exception."),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"MutationFunctionOptions.enforceRefCheck"),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/update-many.interface.ts#L19"},"model/interfaces/update-many.interface.ts:19")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"ignorecase"},"ignoreCase"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"ignoreCase"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.ignoreCase"),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L44"},"handler/find/find-options.ts:44")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"lean"},"lean"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"lean"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.lean"),(0,a.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L43"},"handler/find/find-options.ts:43")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"limit"},"limit"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"limit"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.limit"),(0,a.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L36"},"handler/find/find-options.ts:36")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,a.kt)("p",null,"MutationFunctionOptions.maxExpiry"),(0,a.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/cast-strategy.ts#L53"},"utils/cast-strategy.ts:53")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"nocollection"},"noCollection"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"noCollection"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.noCollection"),(0,a.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L42"},"handler/find/find-options.ts:42")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"populate"},"populate"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"populate"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"PopulateFieldsType")),(0,a.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.populate"),(0,a.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L38"},"handler/find/find-options.ts:38")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"populatemaxdeep"},"populateMaxDeep"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"populateMaxDeep"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.populateMaxDeep"),(0,a.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L39"},"handler/find/find-options.ts:39")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"select"},"select"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"select"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[] ","|"," ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,a.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,a.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.select"),(0,a.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L40"},"handler/find/find-options.ts:40")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"skip"},"skip"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"skip"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.skip"),(0,a.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L35"},"handler/find/find-options.ts:35")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"sort"},"sort"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"sort"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,a.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,a.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,a.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,a.kt)("p",null,"IFindOptions.sort"),(0,a.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L37"},"handler/find/find-options.ts:37")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"strict"},"strict"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"strict"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"ApplyStrategy")),(0,a.kt)("h4",{id:"inherited-from-11"},"Inherited from"),(0,a.kt)("p",null,"MutationFunctionOptions.strict"),(0,a.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/cast-strategy.ts#L52"},"utils/cast-strategy.ts:52")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"transactioncontext"},"transactionContext"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"transactionContext"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"TransactionAttemptContext")),(0,a.kt)("h4",{id:"inherited-from-12"},"Inherited from"),(0,a.kt)("p",null,"MutationFunctionOptions.transactionContext"),(0,a.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/cast-strategy.ts#L55"},"utils/cast-strategy.ts:55")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"upsert"},"upsert"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"upsert"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Default: false\nif true, and no documents found, insert a new document."),(0,a.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/update-many.interface.ts#L11"},"model/interfaces/update-many.interface.ts:11")))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/424d0b50.e8a6c471.js b/assets/js/424d0b50.49a1b2da.js similarity index 95% rename from assets/js/424d0b50.e8a6c471.js rename to assets/js/424d0b50.49a1b2da.js index 1bea9614..4c9f60fb 100644 --- a/assets/js/424d0b50.e8a6c471.js +++ b/assets/js/424d0b50.49a1b2da.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9839],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>u});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=o(a),u=r,c=k["".concat(d,".").concat(u)]||k[u]||m[u]||i;return a?n.createElement(c,l(l({ref:t},s),{},{components:a})):n.createElement(c,l({ref:t},s))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"DateType",title:"Class: DateType",sidebar_label:"DateType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/DateType",id:"api/classes/DateType",title:"Class: DateType",description:"Date are plain JavaScript Date.",source:"@site/docs/api/classes/DateType.md",sourceDirName:"api/classes",slug:"/api/classes/DateType",permalink:"/docs/api/classes/DateType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"DateType",title:"Class: DateType",sidebar_label:"DateType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"CoreType",permalink:"/docs/api/classes/CoreType"},next:{title:"Document",permalink:"/docs/api/classes/Document"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"max",id:"max",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"min",id:"min",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"Methods",id:"methods",level:2},{value:"_checkMaxDate",id:"_checkmaxdate",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"_checkMinDate",id:"_checkmindate",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-7",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-9",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Overrides",id:"overrides-4",level:4},{value:"Defined in",id:"defined-in-18",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Date")," are plain JavaScript Date."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"min")," minimum date value that will be accepted"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"max")," maximum date value that will be accepted")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const userSchema = new Schema({\n birthday: { type: Date, min: '1990-12-31', max: new Date() },\n hired: Schema.Types.Date\n})\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"DateType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new DateType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DateTypeOptions")," & ",(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/date-type.ts#L39"},"schema/types/date-type.ts:39")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"Date.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/date-type.ts#L43"},"schema/types/date-type.ts:43")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"max"},"max"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"max"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateFunction")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/date-type.ts#L53"},"schema/types/date-type.ts:53")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"min"},"min"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"min"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateFunction")),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateFunction")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/date-type.ts#L45"},"schema/types/date-type.ts:45")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_checkmaxdate"},"_","checkMaxDate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMaxDate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Date"))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/date-type.ts#L113"},"schema/types/date-type.ts:113")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkmindate"},"_","checkMinDate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMinDate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Date"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/date-type.ts#L105"},"schema/types/date-type.ts:105")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/date-type.ts#L61"},"schema/types/date-type.ts:61")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/date-type.ts#L69"},"schema/types/date-type.ts:69")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-4"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/date-type.ts#L77"},"schema/types/date-type.ts:77")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9839],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>u});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=o(a),u=r,c=k["".concat(d,".").concat(u)]||k[u]||m[u]||i;return a?n.createElement(c,l(l({ref:t},s),{},{components:a})):n.createElement(c,l({ref:t},s))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"DateType",title:"Class: DateType",sidebar_label:"DateType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/DateType",id:"api/classes/DateType",title:"Class: DateType",description:"Date are plain JavaScript Date.",source:"@site/docs/api/classes/DateType.md",sourceDirName:"api/classes",slug:"/api/classes/DateType",permalink:"/docs/api/classes/DateType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"DateType",title:"Class: DateType",sidebar_label:"DateType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"CoreType",permalink:"/docs/api/classes/CoreType"},next:{title:"Document",permalink:"/docs/api/classes/Document"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"max",id:"max",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"min",id:"min",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"Methods",id:"methods",level:2},{value:"_checkMaxDate",id:"_checkmaxdate",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"_checkMinDate",id:"_checkmindate",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-7",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-9",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Overrides",id:"overrides-4",level:4},{value:"Defined in",id:"defined-in-18",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Date")," are plain JavaScript Date."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"min")," minimum date value that will be accepted"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"max")," maximum date value that will be accepted")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const userSchema = new Schema({\n birthday: { type: Date, min: '1990-12-31', max: new Date() },\n hired: Schema.Types.Date\n})\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"DateType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new DateType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DateTypeOptions")," & ",(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/date-type.ts#L39"},"schema/types/date-type.ts:39")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"Date.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/date-type.ts#L43"},"schema/types/date-type.ts:43")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"max"},"max"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"max"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateFunction")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/date-type.ts#L53"},"schema/types/date-type.ts:53")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"min"},"min"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"min"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateFunction")),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"DateFunction")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/date-type.ts#L45"},"schema/types/date-type.ts:45")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_checkmaxdate"},"_","checkMaxDate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMaxDate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Date"))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/date-type.ts#L113"},"schema/types/date-type.ts:113")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkmindate"},"_","checkMinDate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMinDate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Date"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/date-type.ts#L105"},"schema/types/date-type.ts:105")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Date")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/date-type.ts#L61"},"schema/types/date-type.ts:61")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/date-type.ts#L69"},"schema/types/date-type.ts:69")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-4"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/date-type.ts#L77"},"schema/types/date-type.ts:77")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5189ce25.016e6057.js b/assets/js/5189ce25.2cf088ee.js similarity index 98% rename from assets/js/5189ce25.016e6057.js rename to assets/js/5189ce25.2cf088ee.js index 9b2ae26e..0136098f 100644 --- a/assets/js/5189ce25.016e6057.js +++ b/assets/js/5189ce25.2cf088ee.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[4097],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var n=r(7462),a=(r(7294),r(3905));const o={id:"BuildSchemaError",title:"Class: BuildSchemaError",sidebar_label:"BuildSchemaError",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/BuildSchemaError",id:"api/classes/BuildSchemaError",title:"Class: BuildSchemaError",description:"Hierarchy",source:"@site/docs/api/classes/BuildSchemaError.md",sourceDirName:"api/classes",slug:"/api/classes/BuildSchemaError",permalink:"/docs/api/classes/BuildSchemaError",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"BuildSchemaError",title:"Class: BuildSchemaError",sidebar_label:"BuildSchemaError",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"BooleanType",permalink:"/docs/api/classes/BooleanType"},next:{title:"CoreType",permalink:"/docs/api/classes/CoreType"}},c={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:s};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"BuildSchemaError"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new BuildSchemaError"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"message?"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"message?")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"))))),(0,a.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/exceptions/ottoman-errors.ts#L2"},"exceptions/ottoman-errors.ts:2")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[4097],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(r),m=a,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var n=r(7462),a=(r(7294),r(3905));const o={id:"BuildSchemaError",title:"Class: BuildSchemaError",sidebar_label:"BuildSchemaError",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/BuildSchemaError",id:"api/classes/BuildSchemaError",title:"Class: BuildSchemaError",description:"Hierarchy",source:"@site/docs/api/classes/BuildSchemaError.md",sourceDirName:"api/classes",slug:"/api/classes/BuildSchemaError",permalink:"/docs/api/classes/BuildSchemaError",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"BuildSchemaError",title:"Class: BuildSchemaError",sidebar_label:"BuildSchemaError",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"BooleanType",permalink:"/docs/api/classes/BooleanType"},next:{title:"CoreType",permalink:"/docs/api/classes/CoreType"}},c={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:s};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"BuildSchemaError"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new BuildSchemaError"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"message?"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"message?")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"))))),(0,a.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/exceptions/ottoman-errors.ts#L2"},"exceptions/ottoman-errors.ts:2")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/51c13b82.f4967ccb.js b/assets/js/51c13b82.cdec1260.js similarity index 94% rename from assets/js/51c13b82.f4967ccb.js rename to assets/js/51c13b82.cdec1260.js index 06988eaf..9fe6bf00 100644 --- a/assets/js/51c13b82.f4967ccb.js +++ b/assets/js/51c13b82.cdec1260.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5944],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>c});var n=a(7294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,r=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=o(a),c=l,h=k["".concat(d,".").concat(c)]||k[c]||m[c]||r;return a?n.createElement(h,i(i({ref:t},s),{},{components:a})):n.createElement(h,i({ref:t},s))}));function c(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var r=a.length,i=new Array(r);i[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:l,i[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>o});var n=a(7462),l=(a(7294),a(3905));const r={id:"Schema",title:"Class: Schema",sidebar_label:"Schema",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/classes/Schema",id:"api/classes/Schema",title:"Class: Schema",description:"Constructors",source:"@site/docs/api/classes/Schema.md",sourceDirName:"api/classes",slug:"/api/classes/Schema",permalink:"/docs/api/classes/Schema",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Schema",title:"Class: Schema",sidebar_label:"Schema",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ReferenceType",permalink:"/docs/api/classes/ReferenceType"},next:{title:"SelectClauseException",permalink:"/docs/api/classes/SelectClauseException"}},d={},o=[{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"fields",id:"fields",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"index",id:"index",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"methods",id:"methods",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"options",id:"options",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"postHooks",id:"posthooks",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"preHooks",id:"prehooks",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"queries",id:"queries",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"statics",id:"statics",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"FactoryTypes",id:"factorytypes",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"Types",id:"types",level:3},{value:"Defined in",id:"defined-in-10",level:4},{value:"validators",id:"validators",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"Methods",id:"methods-1",level:2},{value:"_addObject",id:"_addobject",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"_addSchema",id:"_addschema",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"_initPostHooks",id:"_initposthooks",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"_initPreHooks",id:"_initprehooks",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"add",id:"add",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"applyDefaultsToObject",id:"applydefaultstoobject",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"path",id:"path",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-19",level:4},{value:"plugin",id:"plugin",level:3},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"post",id:"post",level:3},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"pre",id:"pre",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"checkHook",id:"checkhook",level:3},{value:"Parameters",id:"parameters-13",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-24",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,l.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h2",{id:"constructors"},"Constructors"),(0,l.kt)("h3",{id:"constructor"},"constructor"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"new Schema"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Summary"))),(0,l.kt)("p",null,"Creates an instance of Schema."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Name"))),(0,l.kt)("p",null,"Schema"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ name: String, age: { type: Number, intVal: true, min: 18 } });\n")),(0,l.kt)("h4",{id:"parameters"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"SchemaDef")),(0,l.kt)("td",{parentName:"tr",align:"left"},"Schema definition")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"options")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"SchemaOptions")),(0,l.kt)("td",{parentName:"tr",align:"left"},"Settings to build schema")))),(0,l.kt)("h4",{id:"defined-in"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L99"},"schema/schema.ts:99")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"fields"},"fields"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"fields"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"FieldMap")),(0,l.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L78"},"schema/schema.ts:78")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"index"},"index"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"index"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SchemaIndex")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L76"},"schema/schema.ts:76")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"methods"},"methods"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"methods"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"any")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L73"},"schema/schema.ts:73")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"options"},"options"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"options"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SchemaOptions")),(0,l.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L79"},"schema/schema.ts:79")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"posthooks"},"postHooks"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"postHooks"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"any")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L75"},"schema/schema.ts:75")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"prehooks"},"preHooks"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"preHooks"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"any")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L74"},"schema/schema.ts:74")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"queries"},"queries"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"queries"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SchemaQuery")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L77"},"schema/schema.ts:77")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"statics"},"statics"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"statics"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"any")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L72"},"schema/schema.ts:72")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"factorytypes"},"FactoryTypes"),(0,l.kt)("p",null,"\u25aa ",(0,l.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,l.kt)("strong",{parentName:"p"},"FactoryTypes"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SupportFactoryTypes")),(0,l.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L51"},"schema/schema.ts:51")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"types"},"Types"),(0,l.kt)("p",null,"\u25aa ",(0,l.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,l.kt)("strong",{parentName:"p"},"Types"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SupportTypes")),(0,l.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L61"},"schema/schema.ts:61")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"validators"},"validators"),(0,l.kt)("p",null,"\u25aa ",(0,l.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,l.kt)("strong",{parentName:"p"},"validators"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"CustomValidations")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L71"},"schema/schema.ts:71")),(0,l.kt)("h2",{id:"methods-1"},"Methods"),(0,l.kt)("h3",{id:"_addobject"},"_","addObject"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"_addObject"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-1"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,l.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"unknown"),">")))),(0,l.kt)("h4",{id:"returns"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L345"},"schema/schema.ts:345")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"_addschema"},"_","addSchema"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"_addSchema"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-2"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema")))))),(0,l.kt)("h4",{id:"returns-1"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L351"},"schema/schema.ts:351")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"_initposthooks"},"_","initPostHooks"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"_initPostHooks"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"handlers"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-3"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HOOKS"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"handlers")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler"),"[]")))),(0,l.kt)("h4",{id:"returns-2"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L307"},"schema/schema.ts:307")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"_initprehooks"},"_","initPreHooks"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"_initPreHooks"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"handlers"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-4"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HOOKS"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"handlers")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler"),"[]")))),(0,l.kt)("h4",{id:"returns-3"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L294"},"schema/schema.ts:294")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"add"},"add"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"add"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),"): ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Adds fields/schema type pairs to this schema."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const plane = new Schema({ name: String });\n const boeing = new Schema({ price: Number });\n boeing.add(plane);\n\n // You can add also add fields to this schema\n boeing.add({ status: Boolean });\n")),(0,l.kt)("h4",{id:"parameters-5"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,l.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"unknown"),">"),(0,l.kt)("td",{parentName:"tr",align:"left"},"Plain object to add, or another schema")))),(0,l.kt)("h4",{id:"returns-4"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Schema"),(0,l.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L334"},"schema/schema.ts:334")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"applydefaultstoobject"},"applyDefaultsToObject"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"applyDefaultsToObject"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("p",null,"Applies default values defined on schema to an object instance."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5 } });\n const result = schema.applyDefaultsToObject({});\n console.log(result)\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"{ amount: 5 }")),(0,l.kt)("h4",{id:"parameters-6"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"any"))))),(0,l.kt)("h4",{id:"returns-5"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L199"},"schema/schema.ts:199")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"cast"},"cast"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"cast"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("p",null,"Cast a model instance using schema definition."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ name: String, age: {type: Number }});\n const result = schema.cast({ name: 'John Doe', age: '34' });\n console.log(result)\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"{ name: 'John Doe', age: 34 }")),(0,l.kt)("h4",{id:"parameters-7"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"data")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"options")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"CastOptions"))))),(0,l.kt)("h4",{id:"returns-6"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L181"},"schema/schema.ts:181")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"path"},"path"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"path"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"path"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},(0,l.kt)("inlineCode",{parentName:"a"},"IOttomanType"))),(0,l.kt)("p",null,"Allows access to a specific field."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5 } });\n const field = schema.path('amount');\n console.log(field.typeName);\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Number")),(0,l.kt)("h4",{id:"parameters-8"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"path")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"string"))))),(0,l.kt)("h4",{id:"returns-7"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},(0,l.kt)("inlineCode",{parentName:"a"},"IOttomanType"))),(0,l.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L230"},"schema/schema.ts:230")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"plugin"},"plugin"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"plugin"),"(...",(0,l.kt)("inlineCode",{parentName:"p"},"fns"),"): ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Allows to apply plugins, to extend schema and model features."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5 } });\n schema.plugin((schema) => console.log(schema.path('amount').typeName));\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Number")),(0,l.kt)("h4",{id:"parameters-9"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"...fns")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"PluginConstructor"),"[]")))),(0,l.kt)("h4",{id:"returns-8"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L243"},"schema/schema.ts:243")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"post"},"post"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"post"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"handler"),"): ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Register a hook function.\nPost hooks are executed after the hooked method."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5} } );\n schema.post(HOOKS.validate, (doc) => console.log(doc));\n")),(0,l.kt)("h4",{id:"parameters-10"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookTypes"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"handler")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler"))))),(0,l.kt)("h4",{id:"returns-9"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L279"},"schema/schema.ts:279")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"pre"},"pre"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"pre"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"handler"),"): ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Register a hook method.\nPre hooks are executed before the hooked method."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5} } );\n schema.pre(HOOKS.validate, (doc) => console.log(doc));\n")),(0,l.kt)("h4",{id:"parameters-11"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookTypes"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"handler")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler"))))),(0,l.kt)("h4",{id:"returns-10"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L261"},"schema/schema.ts:261")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"validate"},"validate"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"validate"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("p",null,"Validate a model instance using the definition of the schema."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ name: String, age: { type: Number, intVal: true, min: 18 } });\n const result = schema.validate({name: 'John Doe', age: '34'});\n console.log(result)\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"{name: 'John Doe', age: 34}")),(0,l.kt)("h4",{id:"parameters-12"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"data")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"options")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"Object"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"options.strict?")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"boolean"))))),(0,l.kt)("h4",{id:"returns-11"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L160"},"schema/schema.ts:160")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"checkhook"},"checkHook"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"checkHook"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-13"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookTypes"))))),(0,l.kt)("h4",{id:"returns-12"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/schema.ts#L288"},"schema/schema.ts:288")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5944],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>c});var n=a(7294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function r(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,r=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=o(a),c=l,h=k["".concat(d,".").concat(c)]||k[c]||m[c]||r;return a?n.createElement(h,i(i({ref:t},s),{},{components:a})):n.createElement(h,i({ref:t},s))}));function c(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var r=a.length,i=new Array(r);i[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:l,i[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>m,frontMatter:()=>r,metadata:()=>p,toc:()=>o});var n=a(7462),l=(a(7294),a(3905));const r={id:"Schema",title:"Class: Schema",sidebar_label:"Schema",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/classes/Schema",id:"api/classes/Schema",title:"Class: Schema",description:"Constructors",source:"@site/docs/api/classes/Schema.md",sourceDirName:"api/classes",slug:"/api/classes/Schema",permalink:"/docs/api/classes/Schema",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Schema",title:"Class: Schema",sidebar_label:"Schema",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ReferenceType",permalink:"/docs/api/classes/ReferenceType"},next:{title:"SelectClauseException",permalink:"/docs/api/classes/SelectClauseException"}},d={},o=[{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"fields",id:"fields",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"index",id:"index",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"methods",id:"methods",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"options",id:"options",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"postHooks",id:"posthooks",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"preHooks",id:"prehooks",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"queries",id:"queries",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"statics",id:"statics",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"FactoryTypes",id:"factorytypes",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"Types",id:"types",level:3},{value:"Defined in",id:"defined-in-10",level:4},{value:"validators",id:"validators",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"Methods",id:"methods-1",level:2},{value:"_addObject",id:"_addobject",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"_addSchema",id:"_addschema",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"_initPostHooks",id:"_initposthooks",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"_initPreHooks",id:"_initprehooks",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"add",id:"add",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"applyDefaultsToObject",id:"applydefaultstoobject",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"path",id:"path",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-19",level:4},{value:"plugin",id:"plugin",level:3},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"post",id:"post",level:3},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"pre",id:"pre",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"checkHook",id:"checkhook",level:3},{value:"Parameters",id:"parameters-13",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-24",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,l.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h2",{id:"constructors"},"Constructors"),(0,l.kt)("h3",{id:"constructor"},"constructor"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"new Schema"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Summary"))),(0,l.kt)("p",null,"Creates an instance of Schema."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Name"))),(0,l.kt)("p",null,"Schema"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ name: String, age: { type: Number, intVal: true, min: 18 } });\n")),(0,l.kt)("h4",{id:"parameters"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"SchemaDef")),(0,l.kt)("td",{parentName:"tr",align:"left"},"Schema definition")),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"options")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"SchemaOptions")),(0,l.kt)("td",{parentName:"tr",align:"left"},"Settings to build schema")))),(0,l.kt)("h4",{id:"defined-in"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L99"},"schema/schema.ts:99")),(0,l.kt)("h2",{id:"properties"},"Properties"),(0,l.kt)("h3",{id:"fields"},"fields"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"fields"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"FieldMap")),(0,l.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L78"},"schema/schema.ts:78")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"index"},"index"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"index"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SchemaIndex")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L76"},"schema/schema.ts:76")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"methods"},"methods"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"methods"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"any")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L73"},"schema/schema.ts:73")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"options"},"options"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"options"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SchemaOptions")),(0,l.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L79"},"schema/schema.ts:79")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"posthooks"},"postHooks"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"postHooks"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"any")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L75"},"schema/schema.ts:75")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"prehooks"},"preHooks"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"preHooks"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"any")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L74"},"schema/schema.ts:74")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"queries"},"queries"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"queries"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SchemaQuery")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L77"},"schema/schema.ts:77")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"statics"},"statics"),(0,l.kt)("p",null,"\u2022 ",(0,l.kt)("strong",{parentName:"p"},"statics"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"any")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L72"},"schema/schema.ts:72")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"factorytypes"},"FactoryTypes"),(0,l.kt)("p",null,"\u25aa ",(0,l.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,l.kt)("strong",{parentName:"p"},"FactoryTypes"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SupportFactoryTypes")),(0,l.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L51"},"schema/schema.ts:51")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"types"},"Types"),(0,l.kt)("p",null,"\u25aa ",(0,l.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,l.kt)("strong",{parentName:"p"},"Types"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"SupportTypes")),(0,l.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L61"},"schema/schema.ts:61")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"validators"},"validators"),(0,l.kt)("p",null,"\u25aa ",(0,l.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,l.kt)("strong",{parentName:"p"},"validators"),": ",(0,l.kt)("inlineCode",{parentName:"p"},"CustomValidations")," = ",(0,l.kt)("inlineCode",{parentName:"p"},"{}")),(0,l.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L71"},"schema/schema.ts:71")),(0,l.kt)("h2",{id:"methods-1"},"Methods"),(0,l.kt)("h3",{id:"_addobject"},"_","addObject"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"_addObject"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-1"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,l.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"unknown"),">")))),(0,l.kt)("h4",{id:"returns"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L345"},"schema/schema.ts:345")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"_addschema"},"_","addSchema"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"_addSchema"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-2"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema")))))),(0,l.kt)("h4",{id:"returns-1"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L351"},"schema/schema.ts:351")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"_initposthooks"},"_","initPostHooks"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"_initPostHooks"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"handlers"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-3"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HOOKS"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"handlers")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler"),"[]")))),(0,l.kt)("h4",{id:"returns-2"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L307"},"schema/schema.ts:307")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"_initprehooks"},"_","initPreHooks"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"_initPreHooks"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"handlers"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-4"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HOOKS"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"handlers")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"undefined")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler")," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler"),"[]")))),(0,l.kt)("h4",{id:"returns-3"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L294"},"schema/schema.ts:294")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"add"},"add"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"add"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),"): ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Adds fields/schema type pairs to this schema."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const plane = new Schema({ name: String });\n const boeing = new Schema({ price: Number });\n boeing.add(plane);\n\n // You can add also add fields to this schema\n boeing.add({ status: Boolean });\n")),(0,l.kt)("h4",{id:"parameters-5"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,l.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,l.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,l.kt)("inlineCode",{parentName:"td"},"unknown"),">"),(0,l.kt)("td",{parentName:"tr",align:"left"},"Plain object to add, or another schema")))),(0,l.kt)("h4",{id:"returns-4"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Schema"),(0,l.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L334"},"schema/schema.ts:334")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"applydefaultstoobject"},"applyDefaultsToObject"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"applyDefaultsToObject"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"obj"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("p",null,"Applies default values defined on schema to an object instance."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5 } });\n const result = schema.applyDefaultsToObject({});\n console.log(result)\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"{ amount: 5 }")),(0,l.kt)("h4",{id:"parameters-6"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"obj")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"any"))))),(0,l.kt)("h4",{id:"returns-5"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L199"},"schema/schema.ts:199")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"cast"},"cast"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"cast"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("p",null,"Cast a model instance using schema definition."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ name: String, age: {type: Number }});\n const result = schema.cast({ name: 'John Doe', age: '34' });\n console.log(result)\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"{ name: 'John Doe', age: 34 }")),(0,l.kt)("h4",{id:"parameters-7"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"data")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"options")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"CastOptions"))))),(0,l.kt)("h4",{id:"returns-6"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L181"},"schema/schema.ts:181")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"path"},"path"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"path"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"path"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},(0,l.kt)("inlineCode",{parentName:"a"},"IOttomanType"))),(0,l.kt)("p",null,"Allows access to a specific field."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5 } });\n const field = schema.path('amount');\n console.log(field.typeName);\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Number")),(0,l.kt)("h4",{id:"parameters-8"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"path")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"string"))))),(0,l.kt)("h4",{id:"returns-7"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},(0,l.kt)("inlineCode",{parentName:"a"},"IOttomanType"))),(0,l.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L230"},"schema/schema.ts:230")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"plugin"},"plugin"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"plugin"),"(...",(0,l.kt)("inlineCode",{parentName:"p"},"fns"),"): ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Allows to apply plugins, to extend schema and model features."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5 } });\n schema.plugin((schema) => console.log(schema.path('amount').typeName));\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"Number")),(0,l.kt)("h4",{id:"parameters-9"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"...fns")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"PluginConstructor"),"[]")))),(0,l.kt)("h4",{id:"returns-8"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L243"},"schema/schema.ts:243")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"post"},"post"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"post"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"handler"),"): ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Register a hook function.\nPost hooks are executed after the hooked method."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5} } );\n schema.post(HOOKS.validate, (doc) => console.log(doc));\n")),(0,l.kt)("h4",{id:"parameters-10"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookTypes"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"handler")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler"))))),(0,l.kt)("h4",{id:"returns-9"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L279"},"schema/schema.ts:279")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"pre"},"pre"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"pre"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"handler"),"): ",(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("p",null,"Register a hook method.\nPre hooks are executed before the hooked method."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ amount: { type: Number, default: 5} } );\n schema.pre(HOOKS.validate, (doc) => console.log(doc));\n")),(0,l.kt)("h4",{id:"parameters-11"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookTypes"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"handler")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookHandler"))))),(0,l.kt)("h4",{id:"returns-10"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,l.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,l.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L261"},"schema/schema.ts:261")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"validate"},"validate"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("strong",{parentName:"p"},"validate"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,l.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("p",null,"Validate a model instance using the definition of the schema."),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = new Schema({ name: String, age: { type: Number, intVal: true, min: 18 } });\n const result = schema.validate({name: 'John Doe', age: '34'});\n console.log(result)\n")),(0,l.kt)("blockquote",null,(0,l.kt)("p",{parentName:"blockquote"},"{name: 'John Doe', age: 34}")),(0,l.kt)("h4",{id:"parameters-12"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"data")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"options")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"Object"))),(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"options.strict?")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"boolean"))))),(0,l.kt)("h4",{id:"returns-11"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"any")),(0,l.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L160"},"schema/schema.ts:160")),(0,l.kt)("hr",null),(0,l.kt)("h3",{id:"checkhook"},"checkHook"),(0,l.kt)("p",null,"\u25b8 ",(0,l.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,l.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,l.kt)("strong",{parentName:"p"},"checkHook"),"(",(0,l.kt)("inlineCode",{parentName:"p"},"hook"),"): ",(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"parameters-13"},"Parameters"),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,l.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"hook")),(0,l.kt)("td",{parentName:"tr",align:"left"},(0,l.kt)("inlineCode",{parentName:"td"},"HookTypes"))))),(0,l.kt)("h4",{id:"returns-12"},"Returns"),(0,l.kt)("p",null,(0,l.kt)("inlineCode",{parentName:"p"},"void")),(0,l.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,l.kt)("p",null,(0,l.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/schema.ts#L288"},"schema/schema.ts:288")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/54834a7a.02dbc9a6.js b/assets/js/54834a7a.02dbc9a6.js deleted file mode 100644 index 8f42808c..00000000 --- a/assets/js/54834a7a.02dbc9a6.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6290],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var r=n(7294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,i=e.mdxType,o=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),f=s(n),u=i,m=f["".concat(p,".").concat(u)]||f[u]||d[u]||o;return n?r.createElement(m,a(a({ref:t},c),{},{components:n})):r.createElement(m,a({ref:t},c))}));function u(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var o=n.length,a=new Array(o);a[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:i,a[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>s});var r=n(7462),i=(n(7294),n(3905));const o={id:"saveOptions",title:"Interface: saveOptions",sidebar_label:"saveOptions",sidebar_position:0,custom_edit_url:null},a=void 0,l={unversionedId:"api/interfaces/saveOptions",id:"api/interfaces/saveOptions",title:"Interface: saveOptions",description:"Properties",source:"@site/docs/api/interfaces/saveOptions.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/saveOptions",permalink:"/docs/api/interfaces/saveOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"saveOptions",title:"Interface: saveOptions",sidebar_label:"saveOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ValidatorOption",permalink:"/docs/api/interfaces/ValidatorOption"},next:{title:"FAQ",permalink:"/docs/faq"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Defined in",id:"defined-in-1",level:4}],c={toc:s};function d(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h2",{id:"properties"},"Properties"),(0,i.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,i.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,i.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,i.kt)("p",null,"Default: false\nenforceRefCheck will check if the referenced document exists\nset to true: will log a warning message.\nset to 'throw': will throw an exception."),(0,i.kt)("h4",{id:"defined-in"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.types.ts#L16"},"model/model.types.ts:16")),(0,i.kt)("hr",null),(0,i.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,i.kt)("p",null,"\u2022 ",(0,i.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,i.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,i.kt)("inlineCode",{parentName:"p"},"number")),(0,i.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,i.kt)("p",null,(0,i.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.types.ts#L8"},"model/model.types.ts:8")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/54834a7a.82e11668.js b/assets/js/54834a7a.82e11668.js new file mode 100644 index 00000000..5c8564f7 --- /dev/null +++ b/assets/js/54834a7a.82e11668.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6290],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var r=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},f=r.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),f=s(n),u=o,m=f["".concat(p,".").concat(u)]||f[u]||d[u]||i;return n?r.createElement(m,a(a({ref:t},c),{},{components:n})):r.createElement(m,a({ref:t},c))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,a=new Array(i);a[0]=f;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:o,a[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(7462),o=(n(7294),n(3905));const i={id:"saveOptions",title:"Interface: saveOptions",sidebar_label:"saveOptions",sidebar_position:0,custom_edit_url:null},a=void 0,l={unversionedId:"api/interfaces/saveOptions",id:"api/interfaces/saveOptions",title:"Interface: saveOptions",description:"Properties",source:"@site/docs/api/interfaces/saveOptions.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/saveOptions",permalink:"/docs/api/interfaces/saveOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"saveOptions",title:"Interface: saveOptions",sidebar_label:"saveOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ValidatorOption",permalink:"/docs/api/interfaces/ValidatorOption"},next:{title:"FAQ",permalink:"/docs/faq"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"transactionContext",id:"transactioncontext",level:3},{value:"Defined in",id:"defined-in-2",level:4}],c={toc:s};function d(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"properties"},"Properties"),(0,o.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,o.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,o.kt)("p",null,"Default: false\nenforceRefCheck will check if the referenced document exists\nset to true: will log a warning message.\nset to 'throw': will throw an exception."),(0,o.kt)("h4",{id:"defined-in"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.types.ts#L17"},"model/model.types.ts:17")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"number")),(0,o.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.types.ts#L9"},"model/model.types.ts:9")),(0,o.kt)("hr",null),(0,o.kt)("h3",{id:"transactioncontext"},"transactionContext"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,o.kt)("strong",{parentName:"p"},"transactionContext"),": ",(0,o.kt)("inlineCode",{parentName:"p"},"TransactionAttemptContext")),(0,o.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.types.ts#L18"},"model/model.types.ts:18")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/54f6948a.d1ee45a5.js b/assets/js/54f6948a.5bb66c9b.js similarity index 95% rename from assets/js/54f6948a.d1ee45a5.js rename to assets/js/54f6948a.5bb66c9b.js index 2bc51416..789b8f9e 100644 --- a/assets/js/54f6948a.d1ee45a5.js +++ b/assets/js/54f6948a.5bb66c9b.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6168],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=o(a),k=r,u=c["".concat(d,".").concat(k)]||c[k]||m[k]||i;return a?n.createElement(u,l(l({ref:t},s),{},{components:a})):n.createElement(u,l({ref:t},s))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=c;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"ReferenceType",title:"Class: ReferenceType",sidebar_label:"ReferenceType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/ReferenceType",id:"api/classes/ReferenceType",title:"Class: ReferenceType",description:"The Reference type creates a relationship between two schemas.",source:"@site/docs/api/classes/ReferenceType.md",sourceDirName:"api/classes",slug:"/api/classes/ReferenceType",permalink:"/docs/api/classes/ReferenceType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ReferenceType",title:"Class: ReferenceType",sidebar_label:"ReferenceType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"QueryOperatorNotFoundException",permalink:"/docs/api/classes/QueryOperatorNotFoundException"},next:{title:"Schema",permalink:"/docs/api/classes/Schema"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"refModel",id:"refmodel",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"schema",id:"schema",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-16",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Reference")," type creates a relationship between two schemas."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const Cat = model('Cat', {name: String});\nconst schema = new Schema({\n type: String,\n isActive: Boolean,\n name: String,\n cats: [{ type: CatSchema, ref: 'Cat' }],\n });\nconst User = model('User', schema);\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"ReferenceType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new ReferenceType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"refModel"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema")))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"refModel")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/reference-type.ts#L36"},"schema/types/reference-type.ts:36")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"refmodel"},"refModel"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"refModel"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/reference-type.ts#L36"},"schema/types/reference-type.ts:36")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"schema"},"schema"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"schema"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/reference-type.ts#L36"},"schema/types/reference-type.ts:36")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"'Reference'")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/reference-type.ts#L39"},"schema/types/reference-type.ts:39")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/reference-type.ts#L41"},"schema/types/reference-type.ts:41")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/reference-type.ts#L45"},"schema/types/reference-type.ts:45")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6168],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),c=o(a),k=r,u=c["".concat(d,".").concat(k)]||c[k]||m[k]||i;return a?n.createElement(u,l(l({ref:t},s),{},{components:a})):n.createElement(u,l({ref:t},s))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=c;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"ReferenceType",title:"Class: ReferenceType",sidebar_label:"ReferenceType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/ReferenceType",id:"api/classes/ReferenceType",title:"Class: ReferenceType",description:"The Reference type creates a relationship between two schemas.",source:"@site/docs/api/classes/ReferenceType.md",sourceDirName:"api/classes",slug:"/api/classes/ReferenceType",permalink:"/docs/api/classes/ReferenceType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ReferenceType",title:"Class: ReferenceType",sidebar_label:"ReferenceType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"QueryOperatorNotFoundException",permalink:"/docs/api/classes/QueryOperatorNotFoundException"},next:{title:"Schema",permalink:"/docs/api/classes/Schema"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"refModel",id:"refmodel",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"schema",id:"schema",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-16",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"Reference")," type creates a relationship between two schemas."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const Cat = model('Cat', {name: String});\nconst schema = new Schema({\n type: String,\n isActive: Boolean,\n name: String,\n cats: [{ type: CatSchema, ref: 'Cat' }],\n });\nconst User = model('User', schema);\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"ReferenceType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new ReferenceType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"refModel"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema")))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"refModel")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/reference-type.ts#L36"},"schema/types/reference-type.ts:36")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"refmodel"},"refModel"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"refModel"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/reference-type.ts#L36"},"schema/types/reference-type.ts:36")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"schema"},"schema"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"schema"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/reference-type.ts#L36"},"schema/types/reference-type.ts:36")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"'Reference'")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/reference-type.ts#L39"},"schema/types/reference-type.ts:39")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/reference-type.ts#L41"},"schema/types/reference-type.ts:41")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/reference-type.ts#L45"},"schema/types/reference-type.ts:45")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/57aadcb5.baf0315c.js b/assets/js/57aadcb5.e2a18761.js similarity index 92% rename from assets/js/57aadcb5.baf0315c.js rename to assets/js/57aadcb5.e2a18761.js index 4330987d..def7889a 100644 --- a/assets/js/57aadcb5.baf0315c.js +++ b/assets/js/57aadcb5.e2a18761.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3675],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var i=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var d=i.createContext({}),p=function(e){var t=i.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=p(e.components);return i.createElement(d.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,d=e.parentName,s=r(e,["components","mdxType","originalType","parentName"]),m=p(n),k=a,c=m["".concat(d,".").concat(k)]||m[k]||u[k]||l;return n?i.createElement(c,o(o({ref:t},s),{},{components:n})):i.createElement(c,o({ref:t},s))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=m;var r={};for(var d in t)hasOwnProperty.call(t,d)&&(r[d]=t[d]);r.originalType=e,r.mdxType="string"==typeof e?e:a,o[1]=r;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var i=n(7462),a=(n(7294),n(3905));const l={id:"ViewIndexOptions",title:"Class: ViewIndexOptions",sidebar_label:"ViewIndexOptions",sidebar_position:0,custom_edit_url:null},o=void 0,r={unversionedId:"api/classes/ViewIndexOptions",id:"api/classes/ViewIndexOptions",title:"Class: ViewIndexOptions",description:"Constructors",source:"@site/docs/api/classes/ViewIndexOptions.md",sourceDirName:"api/classes",slug:"/api/classes/ViewIndexOptions",permalink:"/docs/api/classes/ViewIndexOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ViewIndexOptions",title:"Class: ViewIndexOptions",sidebar_label:"ViewIndexOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ValidationError",permalink:"/docs/api/classes/ValidationError"},next:{title:"WhereClauseException",permalink:"/docs/api/classes/WhereClauseException"}},d={},p=[{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"fullSet",id:"fullset",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"group",id:"group",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"groupLevel",id:"grouplevel",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"idRange",id:"idrange",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"key",id:"key",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"keys",id:"keys",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"limit",id:"limit",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"onError",id:"onerror",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"order",id:"order",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"range",id:"range",level:3},{value:"Type declaration",id:"type-declaration",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"reduce",id:"reduce",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"skip",id:"skip",level:3},{value:"Defined in",id:"defined-in-12",level:4},{value:"stale",id:"stale",level:3},{value:"Defined in",id:"defined-in-13",level:4},{value:"timeout",id:"timeout",level:3},{value:"Defined in",id:"defined-in-14",level:4}],s={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new ViewIndexOptions"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"data"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"data")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("a",{parentName:"td",href:"/docs/api/classes/ViewIndexOptions"},(0,a.kt)("inlineCode",{parentName:"a"},"ViewIndexOptions")))))),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L17"},"model/index/view/view-index-options.ts:17")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"fullset"},"fullSet"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"fullSet"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L13"},"model/index/view/view-index-options.ts:13")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"group"},"group"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"group"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L7"},"model/index/view/view-index-options.ts:7")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"grouplevel"},"groupLevel"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"groupLevel"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L8"},"model/index/view/view-index-options.ts:8")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"idrange"},"idRange"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"idRange"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[] ","|"," { ",(0,a.kt)("inlineCode",{parentName:"p"},"end"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ; ",(0,a.kt)("inlineCode",{parentName:"p"},"start"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," }"),(0,a.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L12"},"model/index/view/view-index-options.ts:12")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"key"},"key"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"key"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L9"},"model/index/view/view-index-options.ts:9")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"keys"},"keys"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"keys"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,a.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L10"},"model/index/view/view-index-options.ts:10")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"limit"},"limit"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"limit"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L3"},"model/index/view/view-index-options.ts:3")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"onerror"},"onError"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"onError"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown")),(0,a.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L14"},"model/index/view/view-index-options.ts:14")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"order"},"order"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"order"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown")),(0,a.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L5"},"model/index/view/view-index-options.ts:5")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"range"},"range"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"range"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("h4",{id:"type-declaration"},"Type declaration"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"end")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"td"},"string"),"[]")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"inclusiveEnd")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"boolean"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"start")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,a.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L11"},"model/index/view/view-index-options.ts:11")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"reduce"},"reduce"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"reduce"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown")),(0,a.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L6"},"model/index/view/view-index-options.ts:6")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"skip"},"skip"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"skip"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L2"},"model/index/view/view-index-options.ts:2")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stale"},"stale"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"stale"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown")),(0,a.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L4"},"model/index/view/view-index-options.ts:4")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"timeout"},"timeout"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"timeout"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/index/view/view-index-options.ts#L15"},"model/index/view/view-index-options.ts:15")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3675],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var i=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var d=i.createContext({}),p=function(e){var t=i.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=p(e.components);return i.createElement(d.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},m=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,l=e.originalType,d=e.parentName,s=r(e,["components","mdxType","originalType","parentName"]),m=p(n),k=a,c=m["".concat(d,".").concat(k)]||m[k]||u[k]||l;return n?i.createElement(c,o(o({ref:t},s),{},{components:n})):i.createElement(c,o({ref:t},s))}));function k(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var l=n.length,o=new Array(l);o[0]=m;var r={};for(var d in t)hasOwnProperty.call(t,d)&&(r[d]=t[d]);r.originalType=e,r.mdxType="string"==typeof e?e:a,o[1]=r;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>u,frontMatter:()=>l,metadata:()=>r,toc:()=>p});var i=n(7462),a=(n(7294),n(3905));const l={id:"ViewIndexOptions",title:"Class: ViewIndexOptions",sidebar_label:"ViewIndexOptions",sidebar_position:0,custom_edit_url:null},o=void 0,r={unversionedId:"api/classes/ViewIndexOptions",id:"api/classes/ViewIndexOptions",title:"Class: ViewIndexOptions",description:"Constructors",source:"@site/docs/api/classes/ViewIndexOptions.md",sourceDirName:"api/classes",slug:"/api/classes/ViewIndexOptions",permalink:"/docs/api/classes/ViewIndexOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ViewIndexOptions",title:"Class: ViewIndexOptions",sidebar_label:"ViewIndexOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ValidationError",permalink:"/docs/api/classes/ValidationError"},next:{title:"WhereClauseException",permalink:"/docs/api/classes/WhereClauseException"}},d={},p=[{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"fullSet",id:"fullset",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"group",id:"group",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"groupLevel",id:"grouplevel",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"idRange",id:"idrange",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"key",id:"key",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"keys",id:"keys",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"limit",id:"limit",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"onError",id:"onerror",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"order",id:"order",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"range",id:"range",level:3},{value:"Type declaration",id:"type-declaration",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"reduce",id:"reduce",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"skip",id:"skip",level:3},{value:"Defined in",id:"defined-in-12",level:4},{value:"stale",id:"stale",level:3},{value:"Defined in",id:"defined-in-13",level:4},{value:"timeout",id:"timeout",level:3},{value:"Defined in",id:"defined-in-14",level:4}],s={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new ViewIndexOptions"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"data"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"data")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("a",{parentName:"td",href:"/docs/api/classes/ViewIndexOptions"},(0,a.kt)("inlineCode",{parentName:"a"},"ViewIndexOptions")))))),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L17"},"model/index/view/view-index-options.ts:17")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"fullset"},"fullSet"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"fullSet"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L13"},"model/index/view/view-index-options.ts:13")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"group"},"group"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"group"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L7"},"model/index/view/view-index-options.ts:7")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"grouplevel"},"groupLevel"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"groupLevel"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L8"},"model/index/view/view-index-options.ts:8")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"idrange"},"idRange"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"idRange"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[] ","|"," { ",(0,a.kt)("inlineCode",{parentName:"p"},"end"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ; ",(0,a.kt)("inlineCode",{parentName:"p"},"start"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," }"),(0,a.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L12"},"model/index/view/view-index-options.ts:12")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"key"},"key"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"key"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L9"},"model/index/view/view-index-options.ts:9")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"keys"},"keys"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"keys"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,a.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L10"},"model/index/view/view-index-options.ts:10")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"limit"},"limit"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"limit"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L3"},"model/index/view/view-index-options.ts:3")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"onerror"},"onError"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"onError"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown")),(0,a.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L14"},"model/index/view/view-index-options.ts:14")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"order"},"order"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"order"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown")),(0,a.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L5"},"model/index/view/view-index-options.ts:5")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"range"},"range"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"range"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Object")),(0,a.kt)("h4",{id:"type-declaration"},"Type declaration"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"end")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"td"},"string"),"[]")),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"inclusiveEnd")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"boolean"))),(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"start")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,a.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L11"},"model/index/view/view-index-options.ts:11")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"reduce"},"reduce"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"reduce"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown")),(0,a.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L6"},"model/index/view/view-index-options.ts:6")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"skip"},"skip"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"skip"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L2"},"model/index/view/view-index-options.ts:2")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"stale"},"stale"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"stale"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown")),(0,a.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L4"},"model/index/view/view-index-options.ts:4")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"timeout"},"timeout"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"timeout"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/index/view/view-index-options.ts#L15"},"model/index/view/view-index-options.ts:15")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/5e86e696.55f453bf.js b/assets/js/5e86e696.ba0cf7d4.js similarity index 98% rename from assets/js/5e86e696.55f453bf.js rename to assets/js/5e86e696.ba0cf7d4.js index a2c5b480..b7f7c766 100644 --- a/assets/js/5e86e696.55f453bf.js +++ b/assets/js/5e86e696.ba0cf7d4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[92],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(r),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var n=r(7462),a=(r(7294),r(3905));const o={id:"WhereClauseException",title:"Class: WhereClauseException",sidebar_label:"WhereClauseException",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/WhereClauseException",id:"api/classes/WhereClauseException",title:"Class: WhereClauseException",description:"Hierarchy",source:"@site/docs/api/classes/WhereClauseException.md",sourceDirName:"api/classes",slug:"/api/classes/WhereClauseException",permalink:"/docs/api/classes/WhereClauseException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"WhereClauseException",title:"Class: WhereClauseException",sidebar_label:"WhereClauseException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ViewIndexOptions",permalink:"/docs/api/classes/ViewIndexOptions"},next:{title:"CreateModelOptions",permalink:"/docs/api/interfaces/CreateModelOptions"}},s={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],c={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"WhereClauseException"))),(0,a.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/classes/QueryOperatorNotFoundException"},(0,a.kt)("inlineCode",{parentName:"a"},"QueryOperatorNotFoundException"))),(0,a.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/classes/QueryGroupByParamsException"},(0,a.kt)("inlineCode",{parentName:"a"},"QueryGroupByParamsException"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new WhereClauseException"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"message?"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"message")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"''"))))),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/exceptions.ts#L11"},"query/exceptions.ts:11")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[92],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>m});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),p=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},c=function(e){var t=p(e.components);return n.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(r),m=a,f=d["".concat(s,".").concat(m)]||d[m]||u[m]||o;return r?n.createElement(f,i(i({ref:t},c),{},{components:r})):n.createElement(f,i({ref:t},c))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var p=2;p{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>u,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var n=r(7462),a=(r(7294),r(3905));const o={id:"WhereClauseException",title:"Class: WhereClauseException",sidebar_label:"WhereClauseException",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/WhereClauseException",id:"api/classes/WhereClauseException",title:"Class: WhereClauseException",description:"Hierarchy",source:"@site/docs/api/classes/WhereClauseException.md",sourceDirName:"api/classes",slug:"/api/classes/WhereClauseException",permalink:"/docs/api/classes/WhereClauseException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"WhereClauseException",title:"Class: WhereClauseException",sidebar_label:"WhereClauseException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ViewIndexOptions",permalink:"/docs/api/classes/ViewIndexOptions"},next:{title:"CreateModelOptions",permalink:"/docs/api/interfaces/CreateModelOptions"}},s={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],c={toc:p};function u(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"WhereClauseException"))),(0,a.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/classes/QueryOperatorNotFoundException"},(0,a.kt)("inlineCode",{parentName:"a"},"QueryOperatorNotFoundException"))),(0,a.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,a.kt)("a",{parentName:"p",href:"/docs/api/classes/QueryGroupByParamsException"},(0,a.kt)("inlineCode",{parentName:"a"},"QueryGroupByParamsException"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new WhereClauseException"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"message?"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"message")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"''"))))),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/exceptions.ts#L11"},"query/exceptions.ts:11")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/62463dcd.eb9194f0.js b/assets/js/62463dcd.a3679378.js similarity index 98% rename from assets/js/62463dcd.eb9194f0.js rename to assets/js/62463dcd.a3679378.js index 65faaa29..281b7d9f 100644 --- a/assets/js/62463dcd.eb9194f0.js +++ b/assets/js/62463dcd.a3679378.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[8938],{3905:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>d});var n=t(7294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),p=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},u=function(e){var r=p(e.components);return n.createElement(c.Provider,{value:r},e.children)},l={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},y=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),y=p(t),d=o,m=y["".concat(c,".").concat(d)]||y[d]||l[d]||a;return t?n.createElement(m,i(i({ref:r},u),{},{components:t})):n.createElement(m,i({ref:r},u))}));function d(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=y;var s={};for(var c in r)hasOwnProperty.call(r,c)&&(s[c]=r[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>l,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=t(7462),o=(t(7294),t(3905));const a={id:"QueryGroupByParamsException",title:"Class: QueryGroupByParamsException",sidebar_label:"QueryGroupByParamsException",sidebar_position:0,custom_edit_url:null},i=void 0,s={unversionedId:"api/classes/QueryGroupByParamsException",id:"api/classes/QueryGroupByParamsException",title:"Class: QueryGroupByParamsException",description:"Hierarchy",source:"@site/docs/api/classes/QueryGroupByParamsException.md",sourceDirName:"api/classes",slug:"/api/classes/QueryGroupByParamsException",permalink:"/docs/api/classes/QueryGroupByParamsException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"QueryGroupByParamsException",title:"Class: QueryGroupByParamsException",sidebar_label:"QueryGroupByParamsException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Query",permalink:"/docs/api/classes/Query"},next:{title:"QueryOperatorNotFoundException",permalink:"/docs/api/classes/QueryOperatorNotFoundException"}},c={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],u={toc:p};function l(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException"},(0,o.kt)("inlineCode",{parentName:"a"},"WhereClauseException"))),(0,o.kt)("p",{parentName:"li"},"\u21b3 ",(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("inlineCode",{parentName:"strong"},"QueryGroupByParamsException"))))),(0,o.kt)("h2",{id:"constructors"},"Constructors"),(0,o.kt)("h3",{id:"constructor"},"constructor"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("strong",{parentName:"p"},"new QueryGroupByParamsException"),"()"),(0,o.kt)("h4",{id:"overrides"},"Overrides"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException"},"WhereClauseException"),".",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException#constructor"},"constructor")),(0,o.kt)("h4",{id:"defined-in"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/exceptions.ts#L38"},"query/exceptions.ts:38")))}l.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[8938],{3905:(e,r,t)=>{t.d(r,{Zo:()=>u,kt:()=>d});var n=t(7294);function o(e,r,t){return r in e?Object.defineProperty(e,r,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[r]=t,e}function a(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);r&&(n=n.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,n)}return t}function i(e){for(var r=1;r=0||(o[t]=e[t]);return o}(e,r);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}var c=n.createContext({}),p=function(e){var r=n.useContext(c),t=r;return e&&(t="function"==typeof e?e(r):i(i({},r),e)),t},u=function(e){var r=p(e.components);return n.createElement(c.Provider,{value:r},e.children)},l={inlineCode:"code",wrapper:function(e){var r=e.children;return n.createElement(n.Fragment,{},r)}},y=n.forwardRef((function(e,r){var t=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),y=p(t),d=o,m=y["".concat(c,".").concat(d)]||y[d]||l[d]||a;return t?n.createElement(m,i(i({ref:r},u),{},{components:t})):n.createElement(m,i({ref:r},u))}));function d(e,r){var t=arguments,o=r&&r.mdxType;if("string"==typeof e||o){var a=t.length,i=new Array(a);i[0]=y;var s={};for(var c in r)hasOwnProperty.call(r,c)&&(s[c]=r[c]);s.originalType=e,s.mdxType="string"==typeof e?e:o,i[1]=s;for(var p=2;p{t.r(r),t.d(r,{assets:()=>c,contentTitle:()=>i,default:()=>l,frontMatter:()=>a,metadata:()=>s,toc:()=>p});var n=t(7462),o=(t(7294),t(3905));const a={id:"QueryGroupByParamsException",title:"Class: QueryGroupByParamsException",sidebar_label:"QueryGroupByParamsException",sidebar_position:0,custom_edit_url:null},i=void 0,s={unversionedId:"api/classes/QueryGroupByParamsException",id:"api/classes/QueryGroupByParamsException",title:"Class: QueryGroupByParamsException",description:"Hierarchy",source:"@site/docs/api/classes/QueryGroupByParamsException.md",sourceDirName:"api/classes",slug:"/api/classes/QueryGroupByParamsException",permalink:"/docs/api/classes/QueryGroupByParamsException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"QueryGroupByParamsException",title:"Class: QueryGroupByParamsException",sidebar_label:"QueryGroupByParamsException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Query",permalink:"/docs/api/classes/Query"},next:{title:"QueryOperatorNotFoundException",permalink:"/docs/api/classes/QueryOperatorNotFoundException"}},c={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],u={toc:p};function l(e){let{components:r,...t}=e;return(0,o.kt)("wrapper",(0,n.Z)({},u,t,{components:r,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException"},(0,o.kt)("inlineCode",{parentName:"a"},"WhereClauseException"))),(0,o.kt)("p",{parentName:"li"},"\u21b3 ",(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("inlineCode",{parentName:"strong"},"QueryGroupByParamsException"))))),(0,o.kt)("h2",{id:"constructors"},"Constructors"),(0,o.kt)("h3",{id:"constructor"},"constructor"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("strong",{parentName:"p"},"new QueryGroupByParamsException"),"()"),(0,o.kt)("h4",{id:"overrides"},"Overrides"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException"},"WhereClauseException"),".",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException#constructor"},"constructor")),(0,o.kt)("h4",{id:"defined-in"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/exceptions.ts#L38"},"query/exceptions.ts:38")))}l.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/63a09e0f.239ad87c.js b/assets/js/63a09e0f.a86a5ca4.js similarity index 97% rename from assets/js/63a09e0f.239ad87c.js rename to assets/js/63a09e0f.a86a5ca4.js index fa011195..b1379ea6 100644 --- a/assets/js/63a09e0f.239ad87c.js +++ b/assets/js/63a09e0f.a86a5ca4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[978],{3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,y=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(y,i(i({ref:t},s),{},{components:r})):n.createElement(y,i({ref:t},s))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var n=r(7462),o=(r(7294),r(3905));const a={id:"QueryOperatorNotFoundException",title:"Class: QueryOperatorNotFoundException",sidebar_label:"QueryOperatorNotFoundException",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/classes/QueryOperatorNotFoundException",id:"api/classes/QueryOperatorNotFoundException",title:"Class: QueryOperatorNotFoundException",description:"Hierarchy",source:"@site/docs/api/classes/QueryOperatorNotFoundException.md",sourceDirName:"api/classes",slug:"/api/classes/QueryOperatorNotFoundException",permalink:"/docs/api/classes/QueryOperatorNotFoundException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"QueryOperatorNotFoundException",title:"Class: QueryOperatorNotFoundException",sidebar_label:"QueryOperatorNotFoundException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"QueryGroupByParamsException",permalink:"/docs/api/classes/QueryGroupByParamsException"},next:{title:"ReferenceType",permalink:"/docs/api/classes/ReferenceType"}},c={},l=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],s={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException"},(0,o.kt)("inlineCode",{parentName:"a"},"WhereClauseException"))),(0,o.kt)("p",{parentName:"li"},"\u21b3 ",(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("inlineCode",{parentName:"strong"},"QueryOperatorNotFoundException"))))),(0,o.kt)("h2",{id:"constructors"},"Constructors"),(0,o.kt)("h3",{id:"constructor"},"constructor"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("strong",{parentName:"p"},"new QueryOperatorNotFoundException"),"(",(0,o.kt)("inlineCode",{parentName:"p"},"operator"),")"),(0,o.kt)("h4",{id:"parameters"},"Parameters"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,o.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:"left"},(0,o.kt)("inlineCode",{parentName:"td"},"operator")),(0,o.kt)("td",{parentName:"tr",align:"left"},(0,o.kt)("inlineCode",{parentName:"td"},"string"))))),(0,o.kt)("h4",{id:"overrides"},"Overrides"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException"},"WhereClauseException"),".",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException#constructor"},"constructor")),(0,o.kt)("h4",{id:"defined-in"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/exceptions.ts#L31"},"query/exceptions.ts:31")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[978],{3905:(e,t,r)=>{r.d(t,{Zo:()=>s,kt:()=>m});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),l=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},s=function(e){var t=l(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),d=l(r),m=o,y=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(y,i(i({ref:t},s),{},{components:r})):n.createElement(y,i({ref:t},s))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var p={};for(var c in t)hasOwnProperty.call(t,c)&&(p[c]=t[c]);p.originalType=e,p.mdxType="string"==typeof e?e:o,i[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>p,toc:()=>l});var n=r(7462),o=(r(7294),r(3905));const a={id:"QueryOperatorNotFoundException",title:"Class: QueryOperatorNotFoundException",sidebar_label:"QueryOperatorNotFoundException",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/classes/QueryOperatorNotFoundException",id:"api/classes/QueryOperatorNotFoundException",title:"Class: QueryOperatorNotFoundException",description:"Hierarchy",source:"@site/docs/api/classes/QueryOperatorNotFoundException.md",sourceDirName:"api/classes",slug:"/api/classes/QueryOperatorNotFoundException",permalink:"/docs/api/classes/QueryOperatorNotFoundException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"QueryOperatorNotFoundException",title:"Class: QueryOperatorNotFoundException",sidebar_label:"QueryOperatorNotFoundException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"QueryGroupByParamsException",permalink:"/docs/api/classes/QueryGroupByParamsException"},next:{title:"ReferenceType",permalink:"/docs/api/classes/ReferenceType"}},c={},l=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],s={toc:l};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},s,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException"},(0,o.kt)("inlineCode",{parentName:"a"},"WhereClauseException"))),(0,o.kt)("p",{parentName:"li"},"\u21b3 ",(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("inlineCode",{parentName:"strong"},"QueryOperatorNotFoundException"))))),(0,o.kt)("h2",{id:"constructors"},"Constructors"),(0,o.kt)("h3",{id:"constructor"},"constructor"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("strong",{parentName:"p"},"new QueryOperatorNotFoundException"),"(",(0,o.kt)("inlineCode",{parentName:"p"},"operator"),")"),(0,o.kt)("h4",{id:"parameters"},"Parameters"),(0,o.kt)("table",null,(0,o.kt)("thead",{parentName:"table"},(0,o.kt)("tr",{parentName:"thead"},(0,o.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,o.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,o.kt)("tbody",{parentName:"table"},(0,o.kt)("tr",{parentName:"tbody"},(0,o.kt)("td",{parentName:"tr",align:"left"},(0,o.kt)("inlineCode",{parentName:"td"},"operator")),(0,o.kt)("td",{parentName:"tr",align:"left"},(0,o.kt)("inlineCode",{parentName:"td"},"string"))))),(0,o.kt)("h4",{id:"overrides"},"Overrides"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException"},"WhereClauseException"),".",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/WhereClauseException#constructor"},"constructor")),(0,o.kt)("h4",{id:"defined-in"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/exceptions.ts#L31"},"query/exceptions.ts:31")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6459de48.ad81d196.js b/assets/js/6459de48.98579fe8.js similarity index 95% rename from assets/js/6459de48.ad81d196.js rename to assets/js/6459de48.98579fe8.js index 26930d74..88c34f52 100644 --- a/assets/js/6459de48.ad81d196.js +++ b/assets/js/6459de48.98579fe8.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3462],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>c});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var o=n.createContext({}),d=function(e){var t=n.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=d(e.components);return n.createElement(o.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=d(a),c=r,u=k["".concat(o,".").concat(c)]||k[c]||m[c]||i;return a?n.createElement(u,l(l({ref:t},s),{},{components:a})):n.createElement(u,l({ref:t},s))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=k;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var d=2;d{a.r(t),a.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var n=a(7462),r=(a(7294),a(3905));const i={id:"CoreType",title:"Class: CoreType",sidebar_label:"CoreType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/CoreType",id:"api/classes/CoreType",title:"Class: CoreType",description:"Param",source:"@site/docs/api/classes/CoreType.md",sourceDirName:"api/classes",slug:"/api/classes/CoreType",permalink:"/docs/api/classes/CoreType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"CoreType",title:"Class: CoreType",sidebar_label:"CoreType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"BuildSchemaError",permalink:"/docs/api/classes/BuildSchemaError"},next:{title:"DateType",permalink:"/docs/api/classes/DateType"}},o={},d=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-14",level:4}],s={toc:d};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"of field in schema"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"name of type"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"flag to define if the field is mandatory"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"that will be applied to the field, allowed function, object or string with the name of the custom validator"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict"),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},(0,r.kt)("inlineCode",{parentName:"a"},"IOttomanType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/EmbedType"},(0,r.kt)("inlineCode",{parentName:"a"},"EmbedType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/StringType"},(0,r.kt)("inlineCode",{parentName:"a"},"StringType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ArrayType"},(0,r.kt)("inlineCode",{parentName:"a"},"ArrayType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/BooleanType"},(0,r.kt)("inlineCode",{parentName:"a"},"BooleanType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/NumberType"},(0,r.kt)("inlineCode",{parentName:"a"},"NumberType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/DateType"},(0,r.kt)("inlineCode",{parentName:"a"},"DateType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ReferenceType"},(0,r.kt)("inlineCode",{parentName:"a"},"ReferenceType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/MixedType"},(0,r.kt)("inlineCode",{parentName:"a"},"MixedType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Protected")," ",(0,r.kt)("strong",{parentName:"p"},"new CoreType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"typeName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"typeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L29"},"schema/types/core-type.ts:29")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Abstract")," ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L52"},"schema/interfaces/schema.types.ts:52")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strict?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L52"},"schema/types/core-type.ts:52")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3462],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>c});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var o=n.createContext({}),d=function(e){var t=n.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=d(e.components);return n.createElement(o.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=d(a),c=r,u=k["".concat(o,".").concat(c)]||k[c]||m[c]||i;return a?n.createElement(u,l(l({ref:t},s),{},{components:a})):n.createElement(u,l({ref:t},s))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=k;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var d=2;d{a.r(t),a.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>d});var n=a(7462),r=(a(7294),a(3905));const i={id:"CoreType",title:"Class: CoreType",sidebar_label:"CoreType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/CoreType",id:"api/classes/CoreType",title:"Class: CoreType",description:"Param",source:"@site/docs/api/classes/CoreType.md",sourceDirName:"api/classes",slug:"/api/classes/CoreType",permalink:"/docs/api/classes/CoreType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"CoreType",title:"Class: CoreType",sidebar_label:"CoreType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"BuildSchemaError",permalink:"/docs/api/classes/BuildSchemaError"},next:{title:"DateType",permalink:"/docs/api/classes/DateType"}},o={},d=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-14",level:4}],s={toc:d};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"of field in schema"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"name of type"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"flag to define if the field is mandatory"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"that will be applied to the field, allowed function, object or string with the name of the custom validator"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Param"))),(0,r.kt)("p",null,"that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict"),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},(0,r.kt)("inlineCode",{parentName:"a"},"IOttomanType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/EmbedType"},(0,r.kt)("inlineCode",{parentName:"a"},"EmbedType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/StringType"},(0,r.kt)("inlineCode",{parentName:"a"},"StringType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ArrayType"},(0,r.kt)("inlineCode",{parentName:"a"},"ArrayType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/BooleanType"},(0,r.kt)("inlineCode",{parentName:"a"},"BooleanType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/NumberType"},(0,r.kt)("inlineCode",{parentName:"a"},"NumberType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/DateType"},(0,r.kt)("inlineCode",{parentName:"a"},"DateType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ReferenceType"},(0,r.kt)("inlineCode",{parentName:"a"},"ReferenceType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/MixedType"},(0,r.kt)("inlineCode",{parentName:"a"},"MixedType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Protected")," ",(0,r.kt)("strong",{parentName:"p"},"new CoreType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"typeName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"typeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L29"},"schema/types/core-type.ts:29")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Abstract")," ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L52"},"schema/interfaces/schema.types.ts:52")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strict?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},"IOttomanType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L52"},"schema/types/core-type.ts:52")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/6aa5616b.211e98f4.js b/assets/js/6aa5616b.381eb9cc.js similarity index 92% rename from assets/js/6aa5616b.211e98f4.js rename to assets/js/6aa5616b.381eb9cc.js index 2d5a6fc6..9da2ebe7 100644 --- a/assets/js/6aa5616b.211e98f4.js +++ b/assets/js/6aa5616b.381eb9cc.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[1423],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var i=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=i.createContext({}),d=function(e){var t=i.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return i.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},c=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=d(n),f=r,m=c["".concat(p,".").concat(f)]||c[f]||u[f]||a;return n?i.createElement(m,l(l({ref:t},s),{},{components:n})):i.createElement(m,l({ref:t},s))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=c;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>d});var i=n(7462),r=(n(7294),n(3905));const a={id:"IConditionExpr",title:"Interface: IConditionExpr",sidebar_label:"IConditionExpr",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/IConditionExpr",id:"api/interfaces/IConditionExpr",title:"Interface: IConditionExpr",description:"List of params to build a SELECT clause",source:"@site/docs/api/interfaces/IConditionExpr.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IConditionExpr",permalink:"/docs/api/interfaces/IConditionExpr",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IConditionExpr",title:"Interface: IConditionExpr",sidebar_label:"IConditionExpr",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"FindOneAndUpdateOption",permalink:"/docs/api/interfaces/FindOneAndUpdateOption"},next:{title:"IField",permalink:"/docs/api/interfaces/IField"}},p={},d=[{value:"Properties",id:"properties",level:2},{value:"groupBy",id:"groupby",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"having",id:"having",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"let",id:"let",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"letting",id:"letting",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"limit",id:"limit",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"offset",id:"offset",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"orderBy",id:"orderby",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"select",id:"select",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"use",id:"use",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"where",id:"where",level:3},{value:"Defined in",id:"defined-in-9",level:4}],s={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,i.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"List of params to build a SELECT clause"),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"groupby"},"groupBy"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"groupBy"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"IGroupBy"),"[]"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L269"},"query/interface/query.types.ts:269")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"having"},"having"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"having"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L271"},"query/interface/query.types.ts:271")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"let"},"let"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"let"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L263"},"query/interface/query.types.ts:263")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"letting"},"letting"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"letting"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L270"},"query/interface/query.types.ts:270")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"limit"},"limit"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"limit"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L266"},"query/interface/query.types.ts:266")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"offset"},"offset"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"offset"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L267"},"query/interface/query.types.ts:267")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"orderby"},"orderBy"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"orderBy"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,r.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L265"},"query/interface/query.types.ts:265")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"select"},"select"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"select"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L262"},"query/interface/query.types.ts:262")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"use"},"use"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"use"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L268"},"query/interface/query.types.ts:268")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"where"},"where"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"where"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L264"},"query/interface/query.types.ts:264")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[1423],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var i=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=i.createContext({}),d=function(e){var t=i.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=d(e.components);return i.createElement(p.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},c=i.forwardRef((function(e,t){var n=e.components,r=e.mdxType,a=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=d(n),f=r,m=c["".concat(p,".").concat(f)]||c[f]||u[f]||a;return n?i.createElement(m,l(l({ref:t},s),{},{components:n})):i.createElement(m,l({ref:t},s))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var a=n.length,l=new Array(a);l[0]=c;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var d=2;d{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>l,default:()=>u,frontMatter:()=>a,metadata:()=>o,toc:()=>d});var i=n(7462),r=(n(7294),n(3905));const a={id:"IConditionExpr",title:"Interface: IConditionExpr",sidebar_label:"IConditionExpr",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/IConditionExpr",id:"api/interfaces/IConditionExpr",title:"Interface: IConditionExpr",description:"List of params to build a SELECT clause",source:"@site/docs/api/interfaces/IConditionExpr.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IConditionExpr",permalink:"/docs/api/interfaces/IConditionExpr",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IConditionExpr",title:"Interface: IConditionExpr",sidebar_label:"IConditionExpr",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"FindOneAndUpdateOption",permalink:"/docs/api/interfaces/FindOneAndUpdateOption"},next:{title:"IField",permalink:"/docs/api/interfaces/IField"}},p={},d=[{value:"Properties",id:"properties",level:2},{value:"groupBy",id:"groupby",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"having",id:"having",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"let",id:"let",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"letting",id:"letting",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"limit",id:"limit",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"offset",id:"offset",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"orderBy",id:"orderby",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"select",id:"select",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"use",id:"use",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"where",id:"where",level:3},{value:"Defined in",id:"defined-in-9",level:4}],s={toc:d};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,i.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"List of params to build a SELECT clause"),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"groupby"},"groupBy"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"groupBy"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"IGroupBy"),"[]"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L269"},"query/interface/query.types.ts:269")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"having"},"having"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"having"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L271"},"query/interface/query.types.ts:271")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"let"},"let"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"let"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L263"},"query/interface/query.types.ts:263")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"letting"},"letting"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"letting"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L270"},"query/interface/query.types.ts:270")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"limit"},"limit"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"limit"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L266"},"query/interface/query.types.ts:266")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"offset"},"offset"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"offset"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L267"},"query/interface/query.types.ts:267")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"orderby"},"orderBy"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"orderBy"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,r.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L265"},"query/interface/query.types.ts:265")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"select"},"select"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"select"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L262"},"query/interface/query.types.ts:262")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"use"},"use"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"use"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L268"},"query/interface/query.types.ts:268")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"where"},"where"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"where"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L264"},"query/interface/query.types.ts:264")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/72264558.aec2d608.js b/assets/js/72264558.db43f672.js similarity index 95% rename from assets/js/72264558.aec2d608.js rename to assets/js/72264558.db43f672.js index 9d32d508..d26a223b 100644 --- a/assets/js/72264558.aec2d608.js +++ b/assets/js/72264558.db43f672.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5466],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>c});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=o(a),c=r,k=u["".concat(d,".").concat(c)]||u[c]||m[c]||i;return a?n.createElement(k,l(l({ref:t},s),{},{components:a})):n.createElement(k,l({ref:t},s))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=u;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"MixedType",title:"Class: MixedType",sidebar_label:"MixedType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/MixedType",id:"api/classes/MixedType",title:"Class: MixedType",description:"Mixed type supports any Object types, you can change the value to anything else, it can be represented in the following ways:",source:"@site/docs/api/classes/MixedType.md",sourceDirName:"api/classes",slug:"/api/classes/MixedType",permalink:"/docs/api/classes/MixedType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"MixedType",title:"Class: MixedType",sidebar_label:"MixedType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ManyQueryResponse",permalink:"/docs/api/classes/ManyQueryResponse"},next:{title:"Model",permalink:"/docs/api/classes/Model"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Inherited from",id:"inherited-from-11",level:4},{value:"Defined in",id:"defined-in-14",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Mixed")," type supports any ",(0,r.kt)("inlineCode",{parentName:"p"},"Object")," types, you can change the value to anything else, it can be represented in the following ways:"),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const schema = new Schema({\n inline: Schema.Types.Mixed,\n types: { type: Schema.Types.Mixed, required: true },\n obj: Object,\n empty: {},\n});\n\nschema.fields.inline instanceof MixedType; // true\nschema.fields.types instanceof MixedType; // true\nschema.fields.obj instanceof MixedType; // true\nschema.fields.empty instanceof MixedType; // true\n\nconst data = {\n inline: { name: \'george\' },\n types: {\n email: \'george@gmail.com\',\n },\n obj: \'Hello\',\n empty: { hello: \'hello\' },\n};\n\nconst result = validate(data, schema);\nconsole.log(result);\n\n// Output!!!\n// {\n// "inline": {\n// "name": "george"\n// },\n// "types": {\n// "email": "george@gmail.com"\n// },\n// "obj": "Hello",\n// "empty": {\n// "hello": "hello"\n// }\n// }\n')),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"MixedType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new MixedType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/mixed-type.ts#L57"},"schema/types/mixed-type.ts:57")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"'Mixed'")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/mixed-type.ts#L61"},"schema/types/mixed-type.ts:61")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/mixed-type.ts#L63"},"schema/types/mixed-type.ts:63")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strict?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-11"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L52"},"schema/types/core-type.ts:52")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5466],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>c});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=o(a),c=r,k=u["".concat(d,".").concat(c)]||u[c]||m[c]||i;return a?n.createElement(k,l(l({ref:t},s),{},{components:a})):n.createElement(k,l({ref:t},s))}));function c(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=u;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"MixedType",title:"Class: MixedType",sidebar_label:"MixedType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/MixedType",id:"api/classes/MixedType",title:"Class: MixedType",description:"Mixed type supports any Object types, you can change the value to anything else, it can be represented in the following ways:",source:"@site/docs/api/classes/MixedType.md",sourceDirName:"api/classes",slug:"/api/classes/MixedType",permalink:"/docs/api/classes/MixedType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"MixedType",title:"Class: MixedType",sidebar_label:"MixedType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ManyQueryResponse",permalink:"/docs/api/classes/ManyQueryResponse"},next:{title:"Model",permalink:"/docs/api/classes/Model"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Inherited from",id:"inherited-from-11",level:4},{value:"Defined in",id:"defined-in-14",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Mixed")," type supports any ",(0,r.kt)("inlineCode",{parentName:"p"},"Object")," types, you can change the value to anything else, it can be represented in the following ways:"),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const schema = new Schema({\n inline: Schema.Types.Mixed,\n types: { type: Schema.Types.Mixed, required: true },\n obj: Object,\n empty: {},\n});\n\nschema.fields.inline instanceof MixedType; // true\nschema.fields.types instanceof MixedType; // true\nschema.fields.obj instanceof MixedType; // true\nschema.fields.empty instanceof MixedType; // true\n\nconst data = {\n inline: { name: \'george\' },\n types: {\n email: \'george@gmail.com\',\n },\n obj: \'Hello\',\n empty: { hello: \'hello\' },\n};\n\nconst result = validate(data, schema);\nconsole.log(result);\n\n// Output!!!\n// {\n// "inline": {\n// "name": "george"\n// },\n// "types": {\n// "email": "george@gmail.com"\n// },\n// "obj": "Hello",\n// "empty": {\n// "hello": "hello"\n// }\n// }\n')),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"MixedType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new MixedType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/mixed-type.ts#L57"},"schema/types/mixed-type.ts:57")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"'Mixed'")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/mixed-type.ts#L61"},"schema/types/mixed-type.ts:61")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/mixed-type.ts#L63"},"schema/types/mixed-type.ts:63")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strict?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-11"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L52"},"schema/types/core-type.ts:52")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7bc59f94.0f3c1ce3.js b/assets/js/7bc59f94.0f3c1ce3.js deleted file mode 100644 index f2b8d059..00000000 --- a/assets/js/7bc59f94.0f3c1ce3.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9664],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var i=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var d=i.createContext({}),p=function(e){var t=i.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},s=function(e){var t=p(e.components);return i.createElement(d.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},u=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,r=e.originalType,d=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(n),f=a,m=u["".concat(d,".").concat(f)]||u[f]||c[f]||r;return n?i.createElement(m,o(o({ref:t},s),{},{components:n})):i.createElement(m,o({ref:t},s))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var r=n.length,o=new Array(r);o[0]=u;var l={};for(var d in t)hasOwnProperty.call(t,d)&&(l[d]=t[d]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>c,frontMatter:()=>r,metadata:()=>l,toc:()=>p});var i=n(7462),a=(n(7294),n(3905));const r={id:"FindByIdOptions",title:"Class: FindByIdOptions",sidebar_label:"FindByIdOptions",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/classes/FindByIdOptions",id:"api/classes/FindByIdOptions",title:"Class: FindByIdOptions",description:"Constructors",source:"@site/docs/api/classes/FindByIdOptions.md",sourceDirName:"api/classes",slug:"/api/classes/FindByIdOptions",permalink:"/docs/api/classes/FindByIdOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"FindByIdOptions",title:"Class: FindByIdOptions",sidebar_label:"FindByIdOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"EmbedType",permalink:"/docs/api/classes/EmbedType"},next:{title:"FindOptions",permalink:"/docs/api/classes/FindOptions"}},d={},p=[{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"lean",id:"lean",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"populate",id:"populate",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"populateMaxDeep",id:"populatemaxdeep",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"select",id:"select",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"timeout",id:"timeout",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"transcoder",id:"transcoder",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"withExpiry",id:"withexpiry",level:3},{value:"Defined in",id:"defined-in-8",level:4}],s={toc:p};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new FindByIdOptions"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"data"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"data")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("a",{parentName:"td",href:"/docs/api/classes/FindByIdOptions"},(0,a.kt)("inlineCode",{parentName:"a"},"FindByIdOptions")))))),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-by-id-options.ts#L18"},"handler/find/find-by-id-options.ts:18")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-by-id-options.ts#L17"},"handler/find/find-by-id-options.ts:17")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"lean"},"lean"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"lean"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Documents returned from queries with the ",(0,a.kt)("inlineCode",{parentName:"p"},"lean")," option enabled are plain javascript objects, not Ottoman Documents. They have no save methods, hooks or other Ottoman Document's features."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const document = await UserModel.findById(id, { lean: true });\ndocument instanceof Document; // false\n")),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-by-id-options.ts#L16"},"handler/find/find-by-id-options.ts:16")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"populate"},"populate"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"populate"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,a.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-by-id-options.ts#L3"},"handler/find/find-by-id-options.ts:3")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"populatemaxdeep"},"populateMaxDeep"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"populateMaxDeep"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-by-id-options.ts#L7"},"handler/find/find-by-id-options.ts:7")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"select"},"select"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"select"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,a.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-by-id-options.ts#L2"},"handler/find/find-by-id-options.ts:2")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"timeout"},"timeout"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"timeout"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-by-id-options.ts#L6"},"handler/find/find-by-id-options.ts:6")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"transcoder"},"transcoder"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"transcoder"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"any")),(0,a.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-by-id-options.ts#L5"},"handler/find/find-by-id-options.ts:5")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"withexpiry"},"withExpiry"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"withExpiry"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-by-id-options.ts#L4"},"handler/find/find-by-id-options.ts:4")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/7bc59f94.b63f5b68.js b/assets/js/7bc59f94.b63f5b68.js new file mode 100644 index 00000000..848e052b --- /dev/null +++ b/assets/js/7bc59f94.b63f5b68.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9664],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>f});var i=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var d=i.createContext({}),p=function(e){var t=i.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},s=function(e){var t=p(e.components);return i.createElement(d.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},u=i.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,d=e.parentName,s=l(e,["components","mdxType","originalType","parentName"]),u=p(n),f=a,m=u["".concat(d,".").concat(f)]||u[f]||c[f]||o;return n?i.createElement(m,r(r({ref:t},s),{},{components:n})):i.createElement(m,r({ref:t},s))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,r=new Array(o);r[0]=u;var l={};for(var d in t)hasOwnProperty.call(t,d)&&(l[d]=t[d]);l.originalType=e,l.mdxType="string"==typeof e?e:a,r[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>r,default:()=>c,frontMatter:()=>o,metadata:()=>l,toc:()=>p});var i=n(7462),a=(n(7294),n(3905));const o={id:"FindByIdOptions",title:"Class: FindByIdOptions",sidebar_label:"FindByIdOptions",sidebar_position:0,custom_edit_url:null},r=void 0,l={unversionedId:"api/classes/FindByIdOptions",id:"api/classes/FindByIdOptions",title:"Class: FindByIdOptions",description:"Constructors",source:"@site/docs/api/classes/FindByIdOptions.md",sourceDirName:"api/classes",slug:"/api/classes/FindByIdOptions",permalink:"/docs/api/classes/FindByIdOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"FindByIdOptions",title:"Class: FindByIdOptions",sidebar_label:"FindByIdOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"EmbedType",permalink:"/docs/api/classes/EmbedType"},next:{title:"FindOptions",permalink:"/docs/api/classes/FindOptions"}},d={},p=[{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"lean",id:"lean",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"populate",id:"populate",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"populateMaxDeep",id:"populatemaxdeep",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"select",id:"select",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"timeout",id:"timeout",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"transactionContext",id:"transactioncontext",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"transcoder",id:"transcoder",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"withExpiry",id:"withexpiry",level:3},{value:"Defined in",id:"defined-in-9",level:4}],s={toc:p};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,i.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new FindByIdOptions"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"data"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"data")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("a",{parentName:"td",href:"/docs/api/classes/FindByIdOptions"},(0,a.kt)("inlineCode",{parentName:"a"},"FindByIdOptions")))))),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L21"},"handler/find/find-by-id-options.ts:21")),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L20"},"handler/find/find-by-id-options.ts:20")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"lean"},"lean"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"lean"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("p",null,"Documents returned from queries with the ",(0,a.kt)("inlineCode",{parentName:"p"},"lean")," option enabled are plain javascript objects, not Ottoman Documents. They have no save methods, hooks or other Ottoman Document's features."),(0,a.kt)("p",null,(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const document = await UserModel.findById(id, { lean: true });\ndocument instanceof Document; // false\n")),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L19"},"handler/find/find-by-id-options.ts:19")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"populate"},"populate"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"populate"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,a.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L6"},"handler/find/find-by-id-options.ts:6")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"populatemaxdeep"},"populateMaxDeep"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"populateMaxDeep"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L10"},"handler/find/find-by-id-options.ts:10")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"select"},"select"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"select"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,a.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L5"},"handler/find/find-by-id-options.ts:5")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"timeout"},"timeout"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"timeout"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L9"},"handler/find/find-by-id-options.ts:9")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"transactioncontext"},"transactionContext"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"transactionContext"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"TransactionAttemptContext")),(0,a.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L4"},"handler/find/find-by-id-options.ts:4")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"transcoder"},"transcoder"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"transcoder"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"any")),(0,a.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L8"},"handler/find/find-by-id-options.ts:8")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"withexpiry"},"withExpiry"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"withExpiry"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-by-id-options.ts#L7"},"handler/find/find-by-id-options.ts:7")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8323ef92.b513a8c7.js b/assets/js/8323ef92.159d5fe8.js similarity index 55% rename from assets/js/8323ef92.b513a8c7.js rename to assets/js/8323ef92.159d5fe8.js index c2cf39f3..bc6c6672 100644 --- a/assets/js/8323ef92.b513a8c7.js +++ b/assets/js/8323ef92.159d5fe8.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[8380],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=a.createContext({}),d=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=d(e.components);return a.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=r(e,["components","mdxType","originalType","parentName"]),p=d(n),u=o,h=p["".concat(l,".").concat(u)]||p[u]||m[u]||i;return n?a.createElement(h,s(s({ref:t},c),{},{components:n})):a.createElement(h,s({ref:t},c))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=p;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r.mdxType="string"==typeof e?e:o,s[1]=r;for(var d=2;d{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>r,toc:()=>d});var a=n(7462),o=(n(7294),n(3905));const i={sidebar_position:2,title:"Schemas"},s="Schema",r={unversionedId:"basic/schema",id:"basic/schema",title:"Schemas",description:"Schema maps to a Couchbase collection and defines the shape of the documents within that collection.",source:"@site/docs/basic/schema.md",sourceDirName:"basic",slug:"/basic/schema",permalink:"/docs/basic/schema",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,title:"Schemas"},sidebar:"tutorialSidebar",previous:{title:"Quickstart",permalink:"/docs/quick-start"},next:{title:"Models",permalink:"/docs/basic/model"}},l={},d=[{value:"Defining Your Schema",id:"defining-your-schema",level:2},{value:"Allowed SchemaTypes",id:"allowed-schematypes",level:2},{value:"Custom SchemaTypes",id:"custom-schematypes",level:3},{value:"Schema Options",id:"schema-options",level:2},{value:"Option Timestamps",id:"option-timestamps",level:3},{value:"Generate UUID for a field",id:"generate-uuid-for-a-field",level:3},{value:"Creating a Model",id:"creating-a-model",level:2},{value:"Instance Methods",id:"instance-methods",level:2},{value:"Statics",id:"statics",level:2},{value:"Indexes",id:"indexes",level:2},{value:"Index Types",id:"index-types",level:2},{value:"N1QL Query Language",id:"n1ql-query-language",level:3},{value:"RefDoc",id:"refdoc",level:3},{value:"View",id:"view",level:3},{value:"Hooks",id:"hooks",level:2},{value:"Available Hooks",id:"available-hooks",level:3},{value:"Register Hooks with pre",id:"register-hooks-with-pre",level:3},{value:"Hooks Use Cases",id:"hooks-use-cases",level:3},{value:"Errors in Pre Hooks",id:"errors-in-pre-hooks",level:3},{value:"Post Hooks",id:"post-hooks",level:3},{value:"Define Hooks Before Compiling Models",id:"define-hooks-before-compiling-models",level:3},{value:"Save/Validate Hooks",id:"savevalidate-hooks",level:3},{value:"Plugins",id:"plugins",level:2},{value:"Plugin Example",id:"plugin-example",level:3},{value:"Global Plugins",id:"global-plugins",level:3},{value:"Strict Mode",id:"strict-mode",level:2},{value:"Schema Types Immutable Option",id:"schema-types-immutable-option",level:2},{value:"Immutable with strategy true (default)",id:"immutable-with-strategy-true-default",level:3},{value:"Immutable with strategy false",id:"immutable-with-strategy-false",level:3},{value:"Immutable with strategy THROW",id:"immutable-with-strategy-throw",level:3},{value:"Schema Helpful Methods",id:"schema-helpful-methods",level:2},{value:"Cast Method",id:"cast-method",level:3},{value:"Cast Method Options",id:"cast-method-options",level:4},{value:"Validate method",id:"validate-method",level:3},{value:"Validate Method Options",id:"validate-method-options",level:4},{value:"Extend Schemas",id:"extend-schemas",level:2},{value:"Add Method",id:"add-method",level:3},{value:"Next Up",id:"next-up",level:2}],c={toc:d};function m(e){let{components:t,...i}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"schema"},"Schema"),(0,o.kt)("p",null,"Schema maps to a Couchbase collection and defines the shape of the documents within that collection."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"How to Use",src:n(4045).Z,width:"997",height:"681"})),(0,o.kt)("h2",{id:"defining-your-schema"},"Defining Your Schema"),(0,o.kt)("p",null,"Everything in Ottoman starts with a Schema."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Schema } from 'ottoman';\n\nconst blogSchema = new Schema({\n title: { type: String, required: true },\n author: String, // String is shorthand for { type: String }\n authorNative: Schema.Types.String,\n body: String,\n comments: [{ body: String, date: Date }],\n date: { type: Date, default: Date.now },\n hidden: Boolean,\n status: { type: String, enum: ['Close', 'Open', 'Review'] },\n meta: {\n votes: { type: Number, min: 0, max: 5 },\n favs: Number,\n },\n mixedObject: Object,\n mixedNative: Schema.Types.Mixed,\n});\n")),(0,o.kt)("p",null,"For more information about options, please ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema.html#allowed-schematypes"},"review the types")),(0,o.kt)("p",null,"Each key in our code ",(0,o.kt)("inlineCode",{parentName:"p"},"blogSchema")," defines a property in our documents which will be cast to its associated ",(0,o.kt)("a",{parentName:"p",href:"#allowed-schematypes"},"SchemaType"),". For example, we've defined a property ",(0,o.kt)("inlineCode",{parentName:"p"},"title")," that will be cast to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/stringtype.html"},"String")," SchemaType and property ",(0,o.kt)("inlineCode",{parentName:"p"},"date")," which will be cast to a ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/datetype.html"},"Date")," SchemaType."),(0,o.kt)("p",null,"Please note above that if a property only requires a type, it can be specified using a shorthand notation (contrast the ",(0,o.kt)("inlineCode",{parentName:"p"},"title")," property above with the ",(0,o.kt)("inlineCode",{parentName:"p"},"date")," property)."),(0,o.kt)("p",null,"Keys may also be assigned to nested objects containing further key/type definitions like the ",(0,o.kt)("inlineCode",{parentName:"p"},"meta")," property above.\nThis will happen whenever a key's value is a POJO that lacks a bona fide ",(0,o.kt)("inlineCode",{parentName:"p"},"type")," property.\nIn these cases, only the leaves in a tree are given actual paths in the schema (like ",(0,o.kt)("inlineCode",{parentName:"p"},"meta.votes")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"meta.favs")," above), and the branches do not have actual paths.\nThe ",(0,o.kt)("inlineCode",{parentName:"p"},"meta")," above cannot have its own validation as a side-effect of this. If validation is needed up the tree, a path needs to be created up the tree."),(0,o.kt)("h2",{id:"allowed-schematypes"},"Allowed SchemaTypes"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/stringtype"},"String")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/numbertype"},"Number")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/booleantype"},"Boolean")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/datetype"},"Date")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/arraytype"},"Array")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/embedtype"},"Embed")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/referencetype"},"Reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/mixedtype"},"Mixed")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("em",{parentName:"li"},(0,o.kt)("a",{parentName:"em",href:"/docs/basic/schema#custom-schematypes"},"Custom")))),(0,o.kt)("p",null,"Schemas not only define the structure of your document and casting of properties, they also define document ",(0,o.kt)("a",{parentName:"p",href:"#instance-methods"},"instance methods"),", ",(0,o.kt)("a",{parentName:"p",href:"#statics"},"static Model methods"),",\n",(0,o.kt)("a",{parentName:"p",href:"#indexes"},"compound indexes"),", ",(0,o.kt)("a",{parentName:"p",href:"#plugins"},"plugins"),", and document lifecycle ",(0,o.kt)("a",{parentName:"p",href:"#hooks"},"hooks"),"."),(0,o.kt)("h3",{id:"custom-schematypes"},"Custom SchemaTypes"),(0,o.kt)("p",null,"Ottoman supports custom types. Before you reach for a custom type, however, know that a custom type is overkill for most use cases."),(0,o.kt)("p",null,"Let's take a look at an example of a basic schema type: a 1-byte integer. To create a new schema type, you need to inherit from ",(0,o.kt)("inlineCode",{parentName:"p"},"IOttomanType")," and add the corresponding ",(0,o.kt)("inlineCode",{parentName:"p"},"registerType"),". The only methods you need to implement are ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema.html#cast-method"},"cast()")," and ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema.html#validate-method"},"validate()"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"class Int8 extends IOttomanType {\n constructor(name: string) {\n super(name, 'Int8');\n }\n\n cast(value: unknown): unknown {\n const castedValue = Number(value);\n return isNaN(castedValue)\n ? checkCastStrategy(value, CAST_STRATEGY.THROW, this)\n : castedValue;\n }\n\n validate(value: unknown): unknown {\n let int8Value = Number(value);\n if (isNaN(int8Value)) {\n throw new ValidationError(`Int8: ${value} is not a number`);\n }\n int8Value = Math.round(int8Value);\n if (int8Value < -0x80 || int8Value > 0x7f) {\n throw new ValidationError(`Int8: ${value} is outside of the range of valid 8-bit ints`);\n }\n return int8Value;\n }\n}\n\n// Don't forget to add `Int8` to the type registry\nregisterType(Int8.name, (fieldName) => new Int8(fieldName));\n\n// Define schema and model\nconst CustomTypeSchema = new Schema({ test: Int8 });\nconst CustomTypeModel = model('CustomTypeExample', CustomTypeSchema);\n\nCustomTypeSchema instanceof Schema; // true\nCustomTypeSchema.path('test') instanceof Int8; // true\n\nconst value = new CustomTypeModel({ test: 0x6f });\nvalue._validate().test; // 111\n\nconst bigger = new CustomTypeModel({ test: 0x8f });\nbigger._validate(); // ValidationError: Int8: 143 is outside of the range of valid 8-bit ints\n\nconst invalid = new CustomTypeModel({ test: 'invalid test value' });\ninvalid._validate(); // ValidationError: Property 'test' must be of type 'Int8'\n\n")),(0,o.kt)("h2",{id:"schema-options"},"Schema Options"),(0,o.kt)("p",null,"Schemas have a few configurable options which can be passed to the constructor:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"new Schema({...}, options);\n")),(0,o.kt)("p",null,"The availables options are:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface SchemaOptions {\n strict?: boolean;\n preHooks?: Hook;\n postHooks?: Hook;\n timestamps?: boolean | SchemaTimestampsConfig;\n}\n")),(0,o.kt)("h3",{id:"option-timestamps"},"Option Timestamps"),(0,o.kt)("p",null,"The timestamps option tells ",(0,o.kt)("inlineCode",{parentName:"p"},"Ottoman")," to assign ",(0,o.kt)("inlineCode",{parentName:"p"},"createdAt")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"updatedAt")," fields to your schema. The type assigned is ",(0,o.kt)("inlineCode",{parentName:"p"},"Date"),"."),(0,o.kt)("p",null,"By default, the names of the fields are ",(0,o.kt)("inlineCode",{parentName:"p"},"createdAt")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"updatedAt"),". Customize the field names by setting ",(0,o.kt)("inlineCode",{parentName:"p"},"timestamps.createdAt")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"timestamps.updatedAt"),"."),(0,o.kt)("p",null,"Basic example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const travelSchema = new Schema({..}, { timestamps: true });\nconst Travel = model('Travel', thingSchema);\nconst travel = new Travel();\nawait travel.save(); // `createdAt` & `updatedAt` will be included\n")),(0,o.kt)("p",null,"Customize ",(0,o.kt)("inlineCode",{parentName:"p"},"createdAt")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"created_at")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const travelSchema = new Schema({..}, { timestamps: { createdAt: 'created_at' } });\nconst Travel = model('Travel', thingSchema);\nconst travel = new Travel();\nawait travel.save(); // `created_at` & `updatedAt` will be included\n")),(0,o.kt)("p",null,"By default, Ottoman uses ",(0,o.kt)("inlineCode",{parentName:"p"},"new Date()")," to get the current time. If you want to overwrite the function Ottoman uses to get the current time, you can set the ",(0,o.kt)("inlineCode",{parentName:"p"},"timestamps.currentTime")," option.\nOttoman will call the ",(0,o.kt)("inlineCode",{parentName:"p"},"timestamps.currentTime")," function whenever it needs to get the current time."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const schema = Schema({\n createdAt: Number,\n updatedAt: Number,\n name: String\n}, {\n // Make Ottoman use Unix time (seconds since Jan 1, 1970)\n timestamps: { currentTime: () => Math.floor(Date.now() / 1000) }\n});\n")),(0,o.kt)("h3",{id:"generate-uuid-for-a-field"},"Generate UUID for a field"),(0,o.kt)("p",null,"Sometimes we want to provide a unique value to a field.\nOttoman provides an easy way to generate a UUID value for a given field by setting the below configuration in the schema."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const schema = new Schema(\n { customId: {type: String, auto: 'uuid'} }\n);\n")),(0,o.kt)("p",null,"Now, every time you create a document, the field ",(0,o.kt)("inlineCode",{parentName:"p"},"customId")," will have a unique value (generated by UUID)."),(0,o.kt)("p",null,"For example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "customId": "0057896b-18a2-4e71-b364-76c8f78979f"\n}\n')),(0,o.kt)("h2",{id:"creating-a-model"},"Creating a Model"),(0,o.kt)("p",null,"To use our schema definition, we need to convert our ",(0,o.kt)("inlineCode",{parentName:"p"},"blogSchema")," into a ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model.html"},"Model")," we can work with. To do so, we pass it into ",(0,o.kt)("inlineCode",{parentName:"p"},"model(modelName, schema)"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Blog = model('Blog', blogSchema);\n// ready to go!\n")),(0,o.kt)("h2",{id:"instance-methods"},"Instance Methods"),(0,o.kt)("p",null,"Instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"Models")," are ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/document"},"documents"),". Documents have many of their own ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"built-in instance methods"),". We may also define our own custom document instance methods."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { connect, Schema } from 'ottoman';\nconst main = async () => {\n // connecting\n const connection = await connect('couchbase://localhost/travel-sample@admin:password');\n\n // define a schema\n const animalSchema = new Schema({ name: String, type: String });\n\n // assign a function to the \"methods\" object of our animalSchema\n animalSchema.methods.findSimilarTypes = function () {\n return connection.getModel('Animal').find({ type: this.type });\n };\n}\n\nmain();\n")),(0,o.kt)("p",null,"Now all of our ",(0,o.kt)("inlineCode",{parentName:"p"},"animal")," instances have a ",(0,o.kt)("inlineCode",{parentName:"p"},"findSimilarTypes")," method available to them."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Animal = model('Animal', animalSchema);\nconst dog = new Animal({ type: 'dog' });\n\nconst dogs = await dog.findSimilarTypes();\nconsole.log(dogs);\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Overwriting a default Ottoman document method may lead to unpredictable results."),(0,o.kt)("li",{parentName:"ul"},"The example above uses the ",(0,o.kt)("inlineCode",{parentName:"li"},"Schema.methods")," object directly to save an instance method.")),(0,o.kt)("p",null,"::: danger Note\nDo ",(0,o.kt)("strong",{parentName:"p"},"not")," declare ",(0,o.kt)("em",{parentName:"p"},"methods")," using ES6 arrow functions (",(0,o.kt)("inlineCode",{parentName:"p"},"=>"),"). Arrow functions ",(0,o.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions"},"explicitly prevent binding")," ",(0,o.kt)("inlineCode",{parentName:"p"},"this"),", so your method will ",(0,o.kt)("strong",{parentName:"p"},"not")," have access to the document, and the above examples will not work.\n:::"),(0,o.kt)("h2",{id:"statics"},"Statics"),(0,o.kt)("p",null,"You can also add static functions to your model."),(0,o.kt)("p",null,"Add a function property to ",(0,o.kt)("inlineCode",{parentName:"p"},"schema.statics")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Assign a function to the \"statics\" object of our animalSchema\nanimalSchema.statics.findByName = function (name) {\n return this.find({ name: name });\n};\n\nconst Animal = model('Animal', animalSchema);\nlet animals = await Animal.findByName('fido');\n")),(0,o.kt)("p",null,"::: danger Note\nDo ",(0,o.kt)("strong",{parentName:"p"},"not")," declare ",(0,o.kt)("em",{parentName:"p"},"statics")," using ES6 arrow functions (",(0,o.kt)("inlineCode",{parentName:"p"},"=>"),"). Arrow functions ",(0,o.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions"},"explicitly prevent binding")," ",(0,o.kt)("inlineCode",{parentName:"p"},"this"),", so the above examples will ",(0,o.kt)("strong",{parentName:"p"},"not")," work because of the value of ",(0,o.kt)("inlineCode",{parentName:"p"},"this"),".\n:::"),(0,o.kt)("h2",{id:"indexes"},"Indexes"),(0,o.kt)("p",null,"You can specify several indexes on a model. There are different kinds of indexes, each with its own benefits and restrictions."),(0,o.kt)("p",null,"To specify indexes on a ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema"},"Schema"),", use the index key on the schema:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Schema } from 'ottoman';\n\nconst schema = new Schema({\n email: String,\n name: {\n first: String,\n last: String,\n full: String,\n },\n});\n\nschema.index.findByEmail = {\n by: 'email',\n type: 'refdoc',\n};\n\nschema.index.findByFirstName = {\n by: 'name.first',\n type: 'view',\n};\n\nschema.index.findByLastName = {\n by: 'name.last',\n type: 'n1ql',\n};\n")),(0,o.kt)("p",null,"To ensure that server is working, you must call the ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," method. This method will internally generate a list of indexes and scopes, collections (if you have the developer preview active) which will be used with the most optimal configuration for them and will build the structures that might be missing on the server. This method must be called after all models are defined, and it is a good idea to call this only when needed rather than any time your server is started."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const { connect, model, start, close } = require('ottoman');\n\nasync function createUser() {\n await connect('couchbase://localhost/travel-sample@admin:password');\n \n const User = model('User', { name: String });\n const user = new User({ name: 'Jane Doe' });\n\n try {\n await start();\n\n console.log(\"Ottoman is ready!\")\n const newUser = await user.save();\n\n await close();\n console.log(`User '${ newUser.name }' successfully created`);\n } catch (e) {\n console.log(`ERROR: ${ e.message }`);\n }\n}\n\ncreateUser();\n")),(0,o.kt)("p",null,"You should see results similar to the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"Ottoman is ready!\nUser 'Jane Doe' successfully created\n")),(0,o.kt)("h2",{id:"index-types"},"Index Types"),(0,o.kt)("p",null,"Below are some quick notes on the types of indexes available, and their pros and cons. For a more in-depth discussion, consider reading ",(0,o.kt)("a",{parentName:"p",href:"https://blog.couchbase.com/determine-data-access-in-couchbase/"},"Couchbasics: How Functional and Performance Needs Determine Data Access in Couchbase"),"."),(0,o.kt)("h3",{id:"n1ql-query-language"},"N1QL Query Language"),(0,o.kt)("p",null,"These indexes are the default and use the Couchbase Server's SQL-like query language, ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/current/n1ql/query.html"},"N1QL"),". When ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," functions are executed, Ottoman automatically creates several secondary indexes so that the models can make queries to the database. These indexes are more performant than views in many cases and are significantly more flexible, allowing even un-indexed searches."),(0,o.kt)("p",null,"N1QL indexes in Ottoman use ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/current/learn/services-and-indexes/indexes/global-secondary-indexes.html"},"Couchbase GSIs"),". If you need speed, and the flexibility of queries, this is the way to go."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const UserSchema = new Schema({\n name: String,\n email: String,\n card: {\n cardNumber: String,\n zipCode: String,\n },\n roles: [{ name: String }],\n});\n\n// N1QL index declaration\nUserSchema.index.findN1qlByNameandEmail = {\n by: ['name', 'email'],\n options: { limit: 4, select: 'name, email' },\n type: 'n1ql',\n};\n\n// Model declaration\nconst User = model('User', UserSchema);\n\n// Some data to test\nconst userData = {\n name: `index`,\n email: 'index@email.com',\n card: { cardNumber: '424242425252', zipCode: '42424' },\n roles: [{ name: 'admin' }],\n};\n\n// Create new user instance\nconst user = new User(userData);\n// Save data\nawait user.save();\n\n// Call findN1qlByNameandEmail index\nconst usersN1ql = await User.findN1qlByNameandEmail([userData.name, userData.email]);\nconsole.log(usersN1ql.rows);\n\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'// Output!!!\n[\n {\n "_type": "User",\n "email": "index@email.com",\n "name": "index"\n }\n]\n')),(0,o.kt)("admonition",{title:"Not Recommended",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndex")," is nice for development, but it's recommended this behavior be disabled in production since index creation can cause a significant performance impact.\nDisable the behavior by not executing ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndex")," function. (for example you can use node env variable to know when you are in development mode ","[process.ENV.development]",")"),(0,o.kt)("p",{parentName:"admonition"},"Notice: the ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," function should be disabled too, owing to its use of ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," internally.")),(0,o.kt)("h3",{id:"refdoc"},"RefDoc"),(0,o.kt)("p",null,"These indexes are the most performant, but the least flexible. They allow only a single document to occupy any particular value and do direct key-value lookups using a referential document to identify a matching document in Couchbase."),(0,o.kt)("p",null,"In short, if you need to look up a document by a single value of a single attribute quickly (e.g. key lookups), this is the way to go. But you cannot combine multiple refdoc indexes to speed up finding something like \"all customers with the first name of 'John' and last name of 'Smith'\"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const UserSchema = new Schema({\n name: String,\n email: String,\n card: {\n cardNumber: String,\n zipCode: String,\n },\n roles: [{ name: String }],\n});\n\n// Refdoc index declaration\nUserSchema.index.findRefName = { by: 'name', type: 'refdoc' };\n\n// Model declaration\nconst User = model('User', UserSchema);\n\n// Some data to test\nconst userData = {\n name: `index`,\n email: 'index@email.com',\n card: { cardNumber: '424242425252', zipCode: '42424' },\n roles: [{ name: 'admin' }],\n};\n\n// Create new user instance\nconst user = new User(userData);\n// Save data\nawait user.save();\n\n// Call findRefName index\nconst userRefdoc = await User.findRefName(userData.name);\nconsole.log(userRefdoc);\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'{\n "name": "index",\n "email": "index@email.com",\n "card": {\n "cardNumber": "424242425252",\n "zipCode": "42424"\n },\n "roles": [\n {\n "name": "admin"\n }\n ],\n "id": "66c2d0dd-76ab-4b91-83b4-353893e3ede3",\n "_type": "User"\n}\n')),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("strong",{parentName:"p"},"Refdoc Index")," is not managed by Couchbase but strictly by Ottoman. It does not guarantee consistency if the keys that are a part of these indexes are updated by an external operation, like N1QL for example."),(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("em",{parentName:"strong"},"Needs to be used with caution!!!")))),(0,o.kt)("h3",{id:"view"},"View"),(0,o.kt)("admonition",{title:"Deprecated",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"View indexes were deprecated in Ottoman v2 and will be removed in the next major version of the package.")),(0,o.kt)("p",null,"This type of index is always available once ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," is called and will work with any Couchbase Server version."),(0,o.kt)("p",null,"Because views use map-reduce, certain types of queries can be faster as the query can be parallelized over all nodes in the cluster, with each node returning only partial results. One of the cons of views is that they are eventually consistent by default, and incur a performance penalty if you want consistency in the result."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const UserSchema = new Schema({\n name: String,\n email: String,\n card: {\n cardNumber: String,\n zipCode: String,\n },\n roles: [{ name: String }],\n});\n\n// View index declaration\nUserSchema.index.findByName = { by: 'name', type: 'view' };\n\n// Model declaration\nconst User = model('User', UserSchema);\n\n// Some data to test\nconst userData = {\n name: `index`,\n email: 'index@email.com',\n card: { cardNumber: '424242425252', zipCode: '42424' },\n roles: [{ name: 'admin' }],\n};\n\n// Create new user instance\nconst user = new User(userData);\n// Save data\nawait user.save();\n\n// Call findByName index\nconst viewIndexOptions = new ViewIndexOptions({ limit: 1 });\nconst usersView = await User.findByName(userData.name, viewIndexOptions);\n")),(0,o.kt)("h2",{id:"hooks"},"Hooks"),(0,o.kt)("p",null,"Hooks are functions that are passed control during the execution of asynchronous functions. Hooks are specified at the schema level and are useful for writing plugins."),(0,o.kt)("h3",{id:"available-hooks"},"Available Hooks"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"validate")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"save")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"update")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"remove"))),(0,o.kt)("h3",{id:"register-hooks-with-pre"},"Register Hooks with ",(0,o.kt)("inlineCode",{parentName:"h3"},"pre")),(0,o.kt)("p",null,"Pre functions are executed one after another, for each hook registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Schema } from 'ottoman';\n\nconst schema = new Schema(...);\nschema.pre('save', function (document) {\n // do stuff\n});\n")),(0,o.kt)("p",null,"You can use a function that returns a promise. In particular, you can use async/await."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"schema.pre('save', function () {\n return doStuff().then(() => doMoreStuff());\n});\n\n// Or, in Node.js >= 7.6.0:\nschema.pre('save', async function () {\n await doStuff();\n await doMoreStuff();\n});\n")),(0,o.kt)("h3",{id:"hooks-use-cases"},"Hooks Use Cases"),(0,o.kt)("p",null,"Hooks are useful for atomizing model logic, such as:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Complex validation;"),(0,o.kt)("li",{parentName:"ul"},"Removing dependent documents (removing a user removes all his blogposts);"),(0,o.kt)("li",{parentName:"ul"},"Asynchronous defaults;"),(0,o.kt)("li",{parentName:"ul"},"Asynchronous tasks that a certain action triggers.")),(0,o.kt)("h3",{id:"errors-in-pre-hooks"},"Errors in Pre Hooks"),(0,o.kt)("p",null,"If any pre hook errors out, Ottoman will not execute subsequent hooks or the hooked function."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"schema.pre('save', function () {\n // You can also return a promise that rejects\n return new Promise((resolve, reject) => {\n reject(new Error('something went wrong'));\n });\n});\n\nschema.pre('save', function () {\n // You can also throw a synchronous error\n throw new Error('something went wrong');\n});\n\nschema.pre('save', async function () {\n await Promise.resolve();\n // You can also throw an error in an `async` function\n throw new Error('something went wrong');\n});\n\n// later...\n\n// Changes will not be persisted to Couchbase Server because a pre hook errored out\ntry {\n await myDoc.save();\n} catch (e) {\n console.log(e.message); // something went wrong\n}\n")),(0,o.kt)("h3",{id:"post-hooks"},"Post Hooks"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"post")," middleware is executed after the hooked method and all of its pre hooks have been completed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"schema.post('validate', function (doc) {\n console.log('%s has been validated (but not saved yet)', doc.id);\n});\nschema.post('save', function (doc) {\n console.log('%s has been saved', doc.id);\n});\nschema.post('remove', function (doc) {\n console.log('%s has been removed', doc.id);\n});\n")),(0,o.kt)("h3",{id:"define-hooks-before-compiling-models"},"Define Hooks Before Compiling Models"),(0,o.kt)("p",null,"Calling ",(0,o.kt)("inlineCode",{parentName:"p"},"pre()")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"post()")," after compiling a model does not work in Ottoman in general. For example, the below ",(0,o.kt)("inlineCode",{parentName:"p"},"pre('save')")," hook will not fire."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const schema = new Schema({ name: String });\n\n// Compile a model from the schema\nconst User = model('User', schema);\n\n// Ottoman will **not** call the middleware function, because\n// this hook was defined after the model was compiled\nschema.pre('save', () => console.log('Hello from pre save'));\n\nnew User({ name: 'test' }).save();\n")),(0,o.kt)("h3",{id:"savevalidate-hooks"},"Save/Validate Hooks"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"save()")," function triggers ",(0,o.kt)("inlineCode",{parentName:"p"},"validate()")," hooks, because Ottoman has a built-in ",(0,o.kt)("inlineCode",{parentName:"p"},"pre('save')")," hook that calls ",(0,o.kt)("inlineCode",{parentName:"p"},"validate()"),". This means that all ",(0,o.kt)("inlineCode",{parentName:"p"},"pre('validate')")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"post('validate')")," hooks get called before any ",(0,o.kt)("inlineCode",{parentName:"p"},"pre('save')")," hooks. The ",(0,o.kt)("inlineCode",{parentName:"p"},"updateById()")," function have the same behavior."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"schema.pre('validate', function () {\n console.log('this gets printed first');\n});\nschema.post('validate', function () {\n console.log('this gets printed second');\n});\nschema.pre('save', function () {\n console.log('this gets printed third');\n});\nschema.post('save', function () {\n console.log('this gets printed fourth');\n});\n")),(0,o.kt)("h2",{id:"plugins"},"Plugins"),(0,o.kt)("p",null,"Schemas are pluggable, that is, they allow for applying pre-packaged capabilities to extend their functionality. This is a very powerful feature."),(0,o.kt)("h3",{id:"plugin-example"},"Plugin Example"),(0,o.kt)("p",null,"Plugins are a tool for reusing logic in multiple schemas. Suppose you have several models in your database and want to add a function to log all doc before save. Just create a plugin once and apply it to each Schema using the ",(0,o.kt)("inlineCode",{parentName:"p"},"plugin")," function:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const pluginLog = (schema) => {\n schema.pre('save', function (doc) {\n console.log(doc)\n });\n};\n\nconst UserSchema = new Schema({\n isActive: Boolean,\n name: String\n});\n\nUserSchema.plugin(pluginLog)\n\nconst UserModel = model('User', UserSchema);\n\nconst user = new UserModel(...);\n// Pre save hooks will be executed and it will print the document just before persisting to Couchbase Server\nawait user.save();\n")),(0,o.kt)("h3",{id:"global-plugins"},"Global Plugins"),(0,o.kt)("p",null,"Want to register a plugin for all schemas? The Ottoman ",(0,o.kt)("inlineCode",{parentName:"p"},"registerGlobalPlugin")," function registers a plugin for every schema. For example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { registerGlobalPlugin } from 'ottoman';\n\nconst pluginLog = (schema) => {\n schema.pre('save', function (doc) {\n console.log(doc)\n });\n};\n\nregisterGlobalPlugin(pluginLog);\n\nconst UserSchema = new Schema({\n isActive: Boolean,\n name: String\n});\n\nconst UserModel = model('User', UserSchema);\n\nconst user = new UserModel(...);\n// Pre save hooks will be executed and it will print the document just before persisting to Couchbase Server\nawait user.save();\n")),(0,o.kt)("h2",{id:"strict-mode"},"Strict Mode"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"strict")," option (enabled by default) ensures that values passed to our model constructor that were not specified in our schema do not get saved to the database."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const userSchema = new Schema({ ... })\nconst User = model('User', userSchema);\nconst user = new User({ iAmNotInTheSchema: true });\nuser.save(); // iAmNotInTheSchema is not saved to the db\n\n// set to false..\nconst userSchema = new Schema({ ... }, { strict: false });\nconst user = new User({ iAmNotInTheSchema: true });\nuser.save(); // iAmNotInTheSchema is now saved to the db!\n")),(0,o.kt)("p",null,"This value can be overridden at the model instance level by passing as second argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const User = model('User', userSchema);\nconst user = new User(doc, { strict: true }); // enables strict mode\nconst user = new User(doc, { strict: false }); // disables strict mode\n")),(0,o.kt)("h2",{id:"schema-types-immutable-option"},"Schema Types Immutable Option"),(0,o.kt)("p",null,"Defines this path as ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable"),". Ottoman prevents you from changing ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," paths allowing, you to safely write untrusted data to Couchbase without any additional validation."),(0,o.kt)("p",null,"With update functions Ottoman also strips updates to ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," properties from ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/interfaces/imodel.html#updatebyid"},"updateById()"),", ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/interfaces/imodel.html#updatemany"},"updateMany()"),", ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/interfaces/imodel.html#replacebyid"},"replaceById()")," and ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/interfaces/imodel.html#findoneandupdate"},"findOneAndUpdate()"),". Your update will succeed if you try to overwrite an ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," property, Ottoman will just strip out the ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," property."),(0,o.kt)("p",null,"Let's see this option in action using ",(0,o.kt)("inlineCode",{parentName:"p"},"findOneAndUpdate")," on ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," properties:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// Define base data\nconst cardData = {\n cardNumber: '5678 5678 5678 5678',\n zipCode: '56789',\n};\n\nconst cardDataUpdate = {\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210',\n};\n\n// Define schemas\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\n\n// Create model\nconst Card = model('Card', CardSchema);\n\n// Start Ottoman instance\nconst ottoman = getDefaultInstance();\nawait ottoman.start();\n\n// Initialize data\nconst { id } = await Card.create(cardData);\n")),(0,o.kt)("h3",{id:"immutable-with-strategy-true-default"},"Immutable with strategy ",(0,o.kt)("inlineCode",{parentName:"h3"},"true")," ",(0,o.kt)("strong",{parentName:"h3"},(0,o.kt)("em",{parentName:"strong"},"(default)"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"await Card.findOneAndUpdate(\n { cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate,\n { new: true, strict: true }\n);\nconst result = await Card.findById(id);\nconsole.log(result);\n")),(0,o.kt)("p",null,"Since ",(0,o.kt)("inlineCode",{parentName:"p"},"cardNumber")," is immutable, Ottoman ignores the update to ",(0,o.kt)("inlineCode",{parentName:"p"},"cardNumber")," and only ",(0,o.kt)("inlineCode",{parentName:"p"},"zipCode")," changed:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"{\n cardNumber: '5678 5678 5678 5678',\n zipCode: '43210'\n}\n")),(0,o.kt)("h3",{id:"immutable-with-strategy-false"},"Immutable with strategy ",(0,o.kt)("inlineCode",{parentName:"h3"},"false")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"await Card.findOneAndUpdate(\n { cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate,\n { new: true, strict: false }\n);\nconst result = await Card.findById(id);\nconsole.log(result);\n")),(0,o.kt)("p",null,"All properties must change:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"{\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210'\n}\n")),(0,o.kt)("h3",{id:"immutable-with-strategy-throw"},"Immutable with strategy ",(0,o.kt)("inlineCode",{parentName:"h3"},"THROW")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"strict")," is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"THROW"),", Ottoman will throw an error if you try to update ",(0,o.kt)("inlineCode",{parentName:"p"},"cardNumber")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"await Card.findOneAndUpdate(\n { cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate,\n { new: true, strict: CAST_STRATEGY.THROW }\n);\n")),(0,o.kt)("p",null,"will get:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"ImmutableError: Field 'cardNumber' is immutable and current cast strategy is set to 'throw'\n")),(0,o.kt)("p",null,"::: tip NOTE\nOttoman's immutability only applies to ",(0,o.kt)("inlineCode",{parentName:"p"},"document")," that have already been saved to the database."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// Define schema\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\n// Create model\nconst Card = model('Card', CardSchema);\n// Create document\nconst myCard = new Card({ cardNumber: '4321 4321 4321 4321', zipCode: '43210' });\n// Document is new\nmyCard.$isNew; // true\n\n// can update the document because $isNew: true\nmyCard.cardNumber = '0000 0000 0000 0000';\nmyCard.cardNumber; // '0000 0000 0000 0000'\n\n// now let's save myCard\nconst ottoman = getDefaultInstance();\nawait ottoman.start();\n\nconst myCardSaved = await myCard.save();\n\n// after save\nmyCardSaved.cardNumber = '1111 1111 1111 1111';\nmyCardSaved.cardNumber; // '0000 0000 0000 0000', because `cardNumber` is immutable\n\n// Example with create\nconst myCard2 = await Card.create({\n cardNumber: '4321 4321 4321 4321',\n zipCode: '3232'\n});\nconst myCard3 = await Card.findOne(\n { cardNumber: '4321 4321 4321 4321' }, // filters\n { consistency: SearchConsistency.LOCAL } // options\n);\n\nmyCard2.$isNew; // false\nmyCard3.$isNew; // false\n")),(0,o.kt)("p",null,":::"),(0,o.kt)("h2",{id:"schema-helpful-methods"},"Schema Helpful Methods"),(0,o.kt)("p",null,"Each ",(0,o.kt)("inlineCode",{parentName:"p"},"Schema")," instance has two helpful methods: ",(0,o.kt)("inlineCode",{parentName:"p"},"cast")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"validate"),"."),(0,o.kt)("h3",{id:"cast-method"},"Cast Method"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"cast")," method gets a Javascript Object as the first parameter and enforces schema types for each field in the schema definition."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const schema = new Schema({\n name: String,\n price: Number,\n createdAt: Date\n})\n\nconst result = schema.cast({\n name: 'TV',\n price: '345.99',\n createdAt: '2020-12-20T16:00:00.000Z'\n})\n")),(0,o.kt)("p",null,"Result variable now look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"{\n name: 'TV',\n price: 345.99, // price was casted to Number\n createdAt: 2020-12-20T16:00:00.000Z //createdAt was casted to Date\n}\n")),(0,o.kt)("h4",{id:"cast-method-options"},"Cast Method Options"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"cast")," method have a few useful options:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"interface CastOptions {\n strict?: boolean;\n skip?: string[];\n strategy?: CAST_STRATEGY;\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"strict")," will remove fields not defined in the schema. The default value is set to true."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"skip")," will be a string array with values of the key you may want to prevent to cast. The default value is empty []."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"strategy")," when cast action fails, defined strategy is applied. The default strategy is set to ",(0,o.kt)("inlineCode",{parentName:"li"},"defaultOrDrop"),".")),(0,o.kt)("p",null,"Available strategies are:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"CAST_STRATEGY\n{\n KEEP = 'keep', // will return original value\n drop = 'DROP', // will remove the field\n THROW = 'throw', // will throw an exception\n DEFAULT_OR_DROP = 'defaultOrDrop', // use default or remove the field if no default was provided\n DEFAULT_OR_KEEP = 'defaultOrKeep' // use default or return original value\n}\n")),(0,o.kt)("h3",{id:"validate-method"},"Validate method"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"validate")," method gets a Javascript Object as the first parameter and enforces schema types, rules, and validations for each field in the schema definition. If something fails an exception will be throw up, else the ",(0,o.kt)("inlineCode",{parentName:"p"},"validate")," method will return a valid object for the current Schema."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const schema = new Schema({\n name: String,\n price: Number,\n createdAt: Date\n})\n\nconst result = schema.validate({\n name: 'TV',\n price: '345.99',\n createdAt: '2020-12-20T16:00:00.000Z'\n})\n")),(0,o.kt)("p",null,"Result variable now looks like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"{\n name: 'TV',\n price: 345.99, # price was casted to Number\n createdAt: 2020-12-20T16:00:00.000Z # createdAt was casted to Date\n}\n")),(0,o.kt)("h4",{id:"validate-method-options"},"Validate Method Options"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"validate")," method has 1 option:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n strict: boolean; // strict set to true, will remove field not defined in the schema\n}\n")),(0,o.kt)("p",null,"By default, it will get the ",(0,o.kt)("inlineCode",{parentName:"p"},"strict")," option value set via the Schema constructor."),(0,o.kt)("h2",{id:"extend-schemas"},"Extend Schemas"),(0,o.kt)("h3",{id:"add-method"},"Add Method"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"add")," method allows adding extra fields or extending properties of other schemas."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"const plane = new Schema({ name: String });\nconst boeing = new Schema({ price: Number });\nboeing.add(plane);\n\n// You can add also add fields to this schema\nboeing.add({ status: Boolean });\n")),(0,o.kt)("p",null,"::: tip\nWhen a schema is added, the following properties are copied: fields, statics, indexes, methods, and hooks. Properties that already exist in the schema (fields, statics, indexes, methods) are overwritten by those of the added schema, except for hooks that are combined.\n:::"),(0,o.kt)("h2",{id:"next-up"},"Next Up"),(0,o.kt)("p",null,"Nice, now we'll can see how ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model"},"Models")," works."))}m.isMDXComponent=!0},4045:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/howToUse-569a5eee66823bc4c5e4346d12eacc6f.jpg"}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[8380],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function s(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=a.createContext({}),d=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},c=function(e){var t=d(e.components);return a.createElement(l.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},p=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,l=e.parentName,c=r(e,["components","mdxType","originalType","parentName"]),p=d(n),u=o,h=p["".concat(l,".").concat(u)]||p[u]||m[u]||i;return n?a.createElement(h,s(s({ref:t},c),{},{components:n})):a.createElement(h,s({ref:t},c))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,s=new Array(i);s[0]=p;var r={};for(var l in t)hasOwnProperty.call(t,l)&&(r[l]=t[l]);r.originalType=e,r.mdxType="string"==typeof e?e:o,s[1]=r;for(var d=2;d{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>m,frontMatter:()=>i,metadata:()=>r,toc:()=>d});var a=n(7462),o=(n(7294),n(3905));const i={sidebar_position:2,title:"Schemas"},s="Schema",r={unversionedId:"basic/schema",id:"basic/schema",title:"Schemas",description:"Schema maps to a Couchbase collection and defines the shape of the documents within that collection.",source:"@site/docs/basic/schema.md",sourceDirName:"basic",slug:"/basic/schema",permalink:"/docs/basic/schema",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{sidebar_position:2,title:"Schemas"},sidebar:"tutorialSidebar",previous:{title:"Quickstart",permalink:"/docs/quick-start"},next:{title:"Models",permalink:"/docs/basic/model"}},l={},d=[{value:"Defining Your Schema",id:"defining-your-schema",level:2},{value:"Allowed SchemaTypes",id:"allowed-schematypes",level:2},{value:"Custom SchemaTypes",id:"custom-schematypes",level:3},{value:"Schema Options",id:"schema-options",level:2},{value:"Option Timestamps",id:"option-timestamps",level:3},{value:"Generate UUID for a field",id:"generate-uuid-for-a-field",level:3},{value:"Creating a Model",id:"creating-a-model",level:2},{value:"Instance Methods",id:"instance-methods",level:2},{value:"Statics",id:"statics",level:2},{value:"Indexes",id:"indexes",level:2},{value:"Index Types",id:"index-types",level:2},{value:"N1QL Query Language",id:"n1ql-query-language",level:3},{value:"RefDoc",id:"refdoc",level:3},{value:"View",id:"view",level:3},{value:"Hooks",id:"hooks",level:2},{value:"Available Hooks",id:"available-hooks",level:3},{value:"Register Hooks with pre",id:"register-hooks-with-pre",level:3},{value:"Hooks Use Cases",id:"hooks-use-cases",level:3},{value:"Errors in Pre Hooks",id:"errors-in-pre-hooks",level:3},{value:"Post Hooks",id:"post-hooks",level:3},{value:"Define Hooks Before Compiling Models",id:"define-hooks-before-compiling-models",level:3},{value:"Save/Validate Hooks",id:"savevalidate-hooks",level:3},{value:"Plugins",id:"plugins",level:2},{value:"Plugin Example",id:"plugin-example",level:3},{value:"Global Plugins",id:"global-plugins",level:3},{value:"Strict Mode",id:"strict-mode",level:2},{value:"Schema Types Immutable Option",id:"schema-types-immutable-option",level:2},{value:"Immutable with strategy true (default)",id:"immutable-with-strategy-true-default",level:3},{value:"Immutable with strategy false",id:"immutable-with-strategy-false",level:3},{value:"Immutable with strategy THROW",id:"immutable-with-strategy-throw",level:3},{value:"Schema Helpful Methods",id:"schema-helpful-methods",level:2},{value:"Cast Method",id:"cast-method",level:3},{value:"Cast Method Options",id:"cast-method-options",level:4},{value:"Validate method",id:"validate-method",level:3},{value:"Validate Method Options",id:"validate-method-options",level:4},{value:"Extend Schemas",id:"extend-schemas",level:2},{value:"Add Method",id:"add-method",level:3},{value:"Next Up",id:"next-up",level:2}],c={toc:d};function m(e){let{components:t,...i}=e;return(0,o.kt)("wrapper",(0,a.Z)({},c,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"schema"},"Schema"),(0,o.kt)("p",null,"Schema maps to a Couchbase collection and defines the shape of the documents within that collection."),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"How to Use",src:n(4045).Z,width:"997",height:"681"})),(0,o.kt)("h2",{id:"defining-your-schema"},"Defining Your Schema"),(0,o.kt)("p",null,"Everything in Ottoman starts with a Schema."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Schema } from 'ottoman';\n\nconst blogSchema = new Schema({\n title: { type: String, required: true },\n author: String, // String is shorthand for { type: String }\n authorNative: Schema.Types.String,\n body: String,\n comments: [{ body: String, date: Date }],\n date: { type: Date, default: Date.now },\n hidden: Boolean,\n status: { type: String, enum: ['Close', 'Open', 'Review'] },\n meta: {\n votes: { type: Number, min: 0, max: 5 },\n favs: Number,\n },\n mixedObject: Object,\n mixedNative: Schema.Types.Mixed,\n});\n")),(0,o.kt)("p",null,"For more information about options, please ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema.html#allowed-schematypes"},"review the types")),(0,o.kt)("p",null,"Each key in our code ",(0,o.kt)("inlineCode",{parentName:"p"},"blogSchema")," defines a property in our documents which will be cast to its associated ",(0,o.kt)("a",{parentName:"p",href:"#allowed-schematypes"},"SchemaType"),". For example, we've defined a property ",(0,o.kt)("inlineCode",{parentName:"p"},"title")," that will be cast to the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/stringtype.html"},"String")," SchemaType and property ",(0,o.kt)("inlineCode",{parentName:"p"},"date")," which will be cast to a ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/datetype.html"},"Date")," SchemaType."),(0,o.kt)("p",null,"Please note above that if a property only requires a type, it can be specified using a shorthand notation (contrast the ",(0,o.kt)("inlineCode",{parentName:"p"},"title")," property above with the ",(0,o.kt)("inlineCode",{parentName:"p"},"date")," property)."),(0,o.kt)("p",null,"Keys may also be assigned to nested objects containing further key/type definitions like the ",(0,o.kt)("inlineCode",{parentName:"p"},"meta")," property above.\nThis will happen whenever a key's value is a POJO that lacks a bona fide ",(0,o.kt)("inlineCode",{parentName:"p"},"type")," property.\nIn these cases, only the leaves in a tree are given actual paths in the schema (like ",(0,o.kt)("inlineCode",{parentName:"p"},"meta.votes")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"meta.favs")," above), and the branches do not have actual paths.\nThe ",(0,o.kt)("inlineCode",{parentName:"p"},"meta")," above cannot have its own validation as a side-effect of this. If validation is needed up the tree, a path needs to be created up the tree."),(0,o.kt)("h2",{id:"allowed-schematypes"},"Allowed SchemaTypes"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/stringtype"},"String")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/numbertype"},"Number")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/booleantype"},"Boolean")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/datetype"},"Date")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/arraytype"},"Array")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/embedtype"},"Embed")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/referencetype"},"Reference")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/mixedtype"},"Mixed")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("em",{parentName:"li"},(0,o.kt)("a",{parentName:"em",href:"/docs/basic/schema#custom-schematypes"},"Custom")))),(0,o.kt)("p",null,"Schemas not only define the structure of your document and casting of properties, they also define document ",(0,o.kt)("a",{parentName:"p",href:"#instance-methods"},"instance methods"),", ",(0,o.kt)("a",{parentName:"p",href:"#statics"},"static Model methods"),",\n",(0,o.kt)("a",{parentName:"p",href:"#indexes"},"compound indexes"),", ",(0,o.kt)("a",{parentName:"p",href:"#plugins"},"plugins"),", and document lifecycle ",(0,o.kt)("a",{parentName:"p",href:"#hooks"},"hooks"),"."),(0,o.kt)("h3",{id:"custom-schematypes"},"Custom SchemaTypes"),(0,o.kt)("p",null,"Ottoman supports custom types. Before you reach for a custom type, however, know that a custom type is overkill for most use cases."),(0,o.kt)("p",null,"Let's take a look at an example of a basic schema type: a 1-byte integer. To create a new schema type, you need to inherit from ",(0,o.kt)("inlineCode",{parentName:"p"},"IOttomanType")," and add the corresponding ",(0,o.kt)("inlineCode",{parentName:"p"},"registerType"),". The only methods you need to implement are ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema.html#cast-method"},"cast()")," and ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema.html#validate-method"},"validate()"),"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"class Int8 extends IOttomanType {\n constructor(name: string) {\n super(name, 'Int8');\n }\n\n cast(value: unknown): unknown {\n const castedValue = Number(value);\n return isNaN(castedValue)\n ? checkCastStrategy(value, CAST_STRATEGY.THROW, this)\n : castedValue;\n }\n\n validate(value: unknown): unknown {\n let int8Value = Number(value);\n if (isNaN(int8Value)) {\n throw new ValidationError(`Int8: ${value} is not a number`);\n }\n int8Value = Math.round(int8Value);\n if (int8Value < -0x80 || int8Value > 0x7f) {\n throw new ValidationError(`Int8: ${value} is outside of the range of valid 8-bit ints`);\n }\n return int8Value;\n }\n}\n\n// Don't forget to add `Int8` to the type registry\nregisterType(Int8.name, (fieldName) => new Int8(fieldName));\n\n// Define schema and model\nconst CustomTypeSchema = new Schema({ test: Int8 });\nconst CustomTypeModel = model('CustomTypeExample', CustomTypeSchema);\n\nCustomTypeSchema instanceof Schema; // true\nCustomTypeSchema.path('test') instanceof Int8; // true\n\nconst value = new CustomTypeModel({ test: 0x6f });\nvalue._validate().test; // 111\n\nconst bigger = new CustomTypeModel({ test: 0x8f });\nbigger._validate(); // ValidationError: Int8: 143 is outside of the range of valid 8-bit ints\n\nconst invalid = new CustomTypeModel({ test: 'invalid test value' });\ninvalid._validate(); // ValidationError: Property 'test' must be of type 'Int8'\n\n")),(0,o.kt)("h2",{id:"schema-options"},"Schema Options"),(0,o.kt)("p",null,"Schemas have a few configurable options which can be passed to the constructor:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"new Schema({...}, options);\n")),(0,o.kt)("p",null,"The availables options are:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"export interface SchemaOptions {\n strict?: boolean;\n preHooks?: Hook;\n postHooks?: Hook;\n timestamps?: boolean | SchemaTimestampsConfig;\n}\n")),(0,o.kt)("h3",{id:"option-timestamps"},"Option Timestamps"),(0,o.kt)("p",null,"The timestamps option tells ",(0,o.kt)("inlineCode",{parentName:"p"},"Ottoman")," to assign ",(0,o.kt)("inlineCode",{parentName:"p"},"createdAt")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"updatedAt")," fields to your schema. The type assigned is ",(0,o.kt)("inlineCode",{parentName:"p"},"Date"),"."),(0,o.kt)("p",null,"By default, the names of the fields are ",(0,o.kt)("inlineCode",{parentName:"p"},"createdAt")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"updatedAt"),". Customize the field names by setting ",(0,o.kt)("inlineCode",{parentName:"p"},"timestamps.createdAt")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"timestamps.updatedAt"),"."),(0,o.kt)("p",null,"Basic example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const travelSchema = new Schema({..}, { timestamps: true });\nconst Travel = model('Travel', thingSchema);\nconst travel = new Travel();\nawait travel.save(); // `createdAt` & `updatedAt` will be included\n")),(0,o.kt)("p",null,"Customize ",(0,o.kt)("inlineCode",{parentName:"p"},"createdAt")," to ",(0,o.kt)("inlineCode",{parentName:"p"},"created_at")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const travelSchema = new Schema({..}, { timestamps: { createdAt: 'created_at' } });\nconst Travel = model('Travel', thingSchema);\nconst travel = new Travel();\nawait travel.save(); // `created_at` & `updatedAt` will be included\n")),(0,o.kt)("p",null,"By default, Ottoman uses ",(0,o.kt)("inlineCode",{parentName:"p"},"new Date()")," to get the current time. If you want to overwrite the function Ottoman uses to get the current time, you can set the ",(0,o.kt)("inlineCode",{parentName:"p"},"timestamps.currentTime")," option.\nOttoman will call the ",(0,o.kt)("inlineCode",{parentName:"p"},"timestamps.currentTime")," function whenever it needs to get the current time."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const schema = Schema({\n createdAt: Number,\n updatedAt: Number,\n name: String\n}, {\n // Make Ottoman use Unix time (seconds since Jan 1, 1970)\n timestamps: { currentTime: () => Math.floor(Date.now() / 1000) }\n});\n")),(0,o.kt)("h3",{id:"generate-uuid-for-a-field"},"Generate UUID for a field"),(0,o.kt)("p",null,"Sometimes we want to provide a unique value to a field.\nOttoman provides an easy way to generate a UUID value for a given field by setting the below configuration in the schema."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const schema = new Schema(\n { customId: {type: String, auto: 'uuid'} }\n);\n")),(0,o.kt)("p",null,"Now, every time you create a document, the field ",(0,o.kt)("inlineCode",{parentName:"p"},"customId")," will have a unique value (generated by UUID)."),(0,o.kt)("p",null,"For example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-json"},'{\n "customId": "0057896b-18a2-4e71-b364-76c8f78979f"\n}\n')),(0,o.kt)("h2",{id:"creating-a-model"},"Creating a Model"),(0,o.kt)("p",null,"To use our schema definition, we need to convert our ",(0,o.kt)("inlineCode",{parentName:"p"},"blogSchema")," into a ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model.html"},"Model")," we can work with. To do so, we pass it into ",(0,o.kt)("inlineCode",{parentName:"p"},"model(modelName, schema)"),":"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Blog = model('Blog', blogSchema);\n// ready to go!\n")),(0,o.kt)("h2",{id:"instance-methods"},"Instance Methods"),(0,o.kt)("p",null,"Instances of ",(0,o.kt)("inlineCode",{parentName:"p"},"Models")," are ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/document"},"documents"),". Documents have many of their own ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"built-in instance methods"),". We may also define our own custom document instance methods."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { connect, Schema } from 'ottoman';\nconst main = async () => {\n // connecting\n const connection = await connect('couchbase://localhost/travel-sample@admin:password');\n\n // define a schema\n const animalSchema = new Schema({ name: String, type: String });\n\n // assign a function to the \"methods\" object of our animalSchema\n animalSchema.methods.findSimilarTypes = function () {\n return connection.getModel('Animal').find({ type: this.type });\n };\n}\n\nmain();\n")),(0,o.kt)("p",null,"Now all of our ",(0,o.kt)("inlineCode",{parentName:"p"},"animal")," instances have a ",(0,o.kt)("inlineCode",{parentName:"p"},"findSimilarTypes")," method available to them."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const Animal = model('Animal', animalSchema);\nconst dog = new Animal({ type: 'dog' });\n\nconst dogs = await dog.findSimilarTypes();\nconsole.log(dogs);\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Overwriting a default Ottoman document method may lead to unpredictable results."),(0,o.kt)("li",{parentName:"ul"},"The example above uses the ",(0,o.kt)("inlineCode",{parentName:"li"},"Schema.methods")," object directly to save an instance method.")),(0,o.kt)("p",null,"::: danger Note\nDo ",(0,o.kt)("strong",{parentName:"p"},"not")," declare ",(0,o.kt)("em",{parentName:"p"},"methods")," using ES6 arrow functions (",(0,o.kt)("inlineCode",{parentName:"p"},"=>"),"). Arrow functions ",(0,o.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions"},"explicitly prevent binding")," ",(0,o.kt)("inlineCode",{parentName:"p"},"this"),", so your method will ",(0,o.kt)("strong",{parentName:"p"},"not")," have access to the document, and the above examples will not work.\n:::"),(0,o.kt)("h2",{id:"statics"},"Statics"),(0,o.kt)("p",null,"You can also add static functions to your model."),(0,o.kt)("p",null,"Add a function property to ",(0,o.kt)("inlineCode",{parentName:"p"},"schema.statics")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"// Assign a function to the \"statics\" object of our animalSchema\nanimalSchema.statics.findByName = function (name) {\n return this.find({ name: name });\n};\n\nconst Animal = model('Animal', animalSchema);\nlet animals = await Animal.findByName('fido');\n")),(0,o.kt)("p",null,"::: danger Note\nDo ",(0,o.kt)("strong",{parentName:"p"},"not")," declare ",(0,o.kt)("em",{parentName:"p"},"statics")," using ES6 arrow functions (",(0,o.kt)("inlineCode",{parentName:"p"},"=>"),"). Arrow functions ",(0,o.kt)("a",{parentName:"p",href:"https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions"},"explicitly prevent binding")," ",(0,o.kt)("inlineCode",{parentName:"p"},"this"),", so the above examples will ",(0,o.kt)("strong",{parentName:"p"},"not")," work because of the value of ",(0,o.kt)("inlineCode",{parentName:"p"},"this"),".\n:::"),(0,o.kt)("h2",{id:"indexes"},"Indexes"),(0,o.kt)("p",null,"You can specify several indexes on a model. There are different kinds of indexes, each with its own benefits and restrictions."),(0,o.kt)("p",null,"To specify indexes on a ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema"},"Schema"),", use the index key on the schema:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Schema } from 'ottoman';\n\nconst schema = new Schema({\n email: String,\n name: {\n first: String,\n last: String,\n full: String,\n },\n});\n\nschema.index.findByEmail = {\n by: 'email',\n type: 'refdoc',\n};\n\nschema.index.findByFirstName = {\n by: 'name.first',\n type: 'view',\n};\n\nschema.index.findByLastName = {\n by: 'name.last',\n type: 'n1ql',\n};\n")),(0,o.kt)("p",null,"To ensure that server is working, you must call the ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," method. This method will internally generate a list of indexes and scopes, collections (if you have the developer preview active) which will be used with the most optimal configuration for them and will build the structures that might be missing on the server. This method must be called after all models are defined, and it is a good idea to call this only when needed rather than any time your server is started."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const { connect, model, start, close } = require('ottoman');\n\nasync function createUser() {\n await connect('couchbase://localhost/travel-sample@admin:password');\n \n const User = model('User', { name: String });\n const user = new User({ name: 'Jane Doe' });\n\n try {\n await start();\n\n console.log(\"Ottoman is ready!\")\n const newUser = await user.save();\n\n await close();\n console.log(`User '${ newUser.name }' successfully created`);\n } catch (e) {\n console.log(`ERROR: ${ e.message }`);\n }\n}\n\ncreateUser();\n")),(0,o.kt)("p",null,"You should see results similar to the following:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-bash"},"Ottoman is ready!\nUser 'Jane Doe' successfully created\n")),(0,o.kt)("h2",{id:"index-types"},"Index Types"),(0,o.kt)("p",null,"Below are some quick notes on the types of indexes available, and their pros and cons. For a more in-depth discussion, consider reading ",(0,o.kt)("a",{parentName:"p",href:"https://blog.couchbase.com/determine-data-access-in-couchbase/"},"Couchbasics: How Functional and Performance Needs Determine Data Access in Couchbase"),"."),(0,o.kt)("h3",{id:"n1ql-query-language"},"N1QL Query Language"),(0,o.kt)("p",null,"These indexes are the default and use the Couchbase Server's SQL-like query language, ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/current/n1ql/query.html"},"N1QL"),". When ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," functions are executed, Ottoman automatically creates several secondary indexes so that the models can make queries to the database. These indexes are more performant than views in many cases and are significantly more flexible, allowing even un-indexed searches."),(0,o.kt)("p",null,"N1QL indexes in Ottoman use ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/current/learn/services-and-indexes/indexes/global-secondary-indexes.html"},"Couchbase GSIs"),". If you need speed, and the flexibility of queries, this is the way to go."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const UserSchema = new Schema({\n name: String,\n email: String,\n card: {\n cardNumber: String,\n zipCode: String,\n },\n roles: [{ name: String }],\n});\n\n// N1QL index declaration\nUserSchema.index.findN1qlByNameandEmail = {\n by: ['name', 'email'],\n options: { limit: 4, select: 'name, email' },\n type: 'n1ql',\n};\n\n// Model declaration\nconst User = model('User', UserSchema);\n\n// Some data to test\nconst userData = {\n name: `index`,\n email: 'index@email.com',\n card: { cardNumber: '424242425252', zipCode: '42424' },\n roles: [{ name: 'admin' }],\n};\n\n// Create new user instance\nconst user = new User(userData);\n// Save data\nawait user.save();\n\n// Call findN1qlByNameandEmail index\nconst usersN1ql = await User.findN1qlByNameandEmail([userData.name, userData.email]);\nconsole.log(usersN1ql.rows);\n\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'// Output!!!\n[\n {\n "_type": "User",\n "email": "index@email.com",\n "name": "index"\n }\n]\n')),(0,o.kt)("admonition",{title:"Not Recommended",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndex")," is nice for development, but it's recommended this behavior be disabled in production since index creation can cause a significant performance impact.\nDisable the behavior by not executing ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndex")," function. (for example you can use node env variable to know when you are in development mode ","[process.ENV.development]",")"),(0,o.kt)("p",{parentName:"admonition"},"Notice: the ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," function should be disabled too, owing to its use of ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," internally.")),(0,o.kt)("h3",{id:"refdoc"},"RefDoc"),(0,o.kt)("p",null,"These indexes are the most performant, but the least flexible. They allow only a single document to occupy any particular value and do direct key-value lookups using a referential document to identify a matching document in Couchbase."),(0,o.kt)("p",null,"In short, if you need to look up a document by a single value of a single attribute quickly (e.g. key lookups), this is the way to go. But you cannot combine multiple refdoc indexes to speed up finding something like \"all customers with the first name of 'John' and last name of 'Smith'\"."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const UserSchema = new Schema({\n name: String,\n email: String,\n card: {\n cardNumber: String,\n zipCode: String,\n },\n roles: [{ name: String }],\n});\n\n// Refdoc index declaration\nUserSchema.index.findRefName = { by: 'name', type: 'refdoc' };\n\n// Model declaration\nconst User = model('User', UserSchema);\n\n// Some data to test\nconst userData = {\n name: `index`,\n email: 'index@email.com',\n card: { cardNumber: '424242425252', zipCode: '42424' },\n roles: [{ name: 'admin' }],\n};\n\n// Create new user instance\nconst user = new User(userData);\n// Save data\nawait user.save();\n\n// Call findRefName index\nconst userRefdoc = await User.findRefName(userData.name);\nconsole.log(userRefdoc);\n")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},'{\n "name": "index",\n "email": "index@email.com",\n "card": {\n "cardNumber": "424242425252",\n "zipCode": "42424"\n },\n "roles": [\n {\n "name": "admin"\n }\n ],\n "id": "66c2d0dd-76ab-4b91-83b4-353893e3ede3",\n "_type": "User"\n}\n')),(0,o.kt)("admonition",{type:"danger"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("strong",{parentName:"p"},"RefDoc Indexes")," are not currently supported with transactions. If you plan to use transactions, see ",(0,o.kt)("a",{parentName:"p",href:"/docs/advanced/transactions#transactions-with-refdoc-indexes"},"Ottoman Transactions")," for more information.")),(0,o.kt)("admonition",{type:"caution"},(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("strong",{parentName:"p"},"RefDoc Indexes")," are not managed by Couchbase but strictly by Ottoman. It does not guarantee consistency if the keys that are a part of these indexes are updated by an external operation, like N1QL for example."),(0,o.kt)("p",{parentName:"admonition"},(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("em",{parentName:"strong"},"Please use with caution!")))),(0,o.kt)("h3",{id:"view"},"View"),(0,o.kt)("admonition",{title:"Deprecated",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"View indexes were deprecated in Ottoman v2 and will be removed in the next major version of the package.")),(0,o.kt)("p",null,"This type of index is always available once ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," is called and will work with any Couchbase Server version."),(0,o.kt)("p",null,"Because views use map-reduce, certain types of queries can be faster as the query can be parallelized over all nodes in the cluster, with each node returning only partial results. One of the cons of views is that they are eventually consistent by default, and incur a performance penalty if you want consistency in the result."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"const UserSchema = new Schema({\n name: String,\n email: String,\n card: {\n cardNumber: String,\n zipCode: String,\n },\n roles: [{ name: String }],\n});\n\n// View index declaration\nUserSchema.index.findByName = { by: 'name', type: 'view' };\n\n// Model declaration\nconst User = model('User', UserSchema);\n\n// Some data to test\nconst userData = {\n name: `index`,\n email: 'index@email.com',\n card: { cardNumber: '424242425252', zipCode: '42424' },\n roles: [{ name: 'admin' }],\n};\n\n// Create new user instance\nconst user = new User(userData);\n// Save data\nawait user.save();\n\n// Call findByName index\nconst viewIndexOptions = new ViewIndexOptions({ limit: 1 });\nconst usersView = await User.findByName(userData.name, viewIndexOptions);\n")),(0,o.kt)("h2",{id:"hooks"},"Hooks"),(0,o.kt)("p",null,"Hooks are functions that are passed control during the execution of asynchronous functions. Hooks are specified at the schema level and are useful for writing plugins."),(0,o.kt)("h3",{id:"available-hooks"},"Available Hooks"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"validate")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"save")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"update")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"remove"))),(0,o.kt)("h3",{id:"register-hooks-with-pre"},"Register Hooks with ",(0,o.kt)("inlineCode",{parentName:"h3"},"pre")),(0,o.kt)("p",null,"Pre functions are executed one after another, for each hook registered."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Schema } from 'ottoman';\n\nconst schema = new Schema(...);\nschema.pre('save', function (document) {\n // do stuff\n});\n")),(0,o.kt)("p",null,"You can use a function that returns a promise. In particular, you can use async/await."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"schema.pre('save', function () {\n return doStuff().then(() => doMoreStuff());\n});\n\n// Or, in Node.js >= 7.6.0:\nschema.pre('save', async function () {\n await doStuff();\n await doMoreStuff();\n});\n")),(0,o.kt)("h3",{id:"hooks-use-cases"},"Hooks Use Cases"),(0,o.kt)("p",null,"Hooks are useful for atomizing model logic, such as:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Complex validation;"),(0,o.kt)("li",{parentName:"ul"},"Removing dependent documents (removing a user removes all his blogposts);"),(0,o.kt)("li",{parentName:"ul"},"Asynchronous defaults;"),(0,o.kt)("li",{parentName:"ul"},"Asynchronous tasks that a certain action triggers.")),(0,o.kt)("h3",{id:"errors-in-pre-hooks"},"Errors in Pre Hooks"),(0,o.kt)("p",null,"If any pre hook errors out, Ottoman will not execute subsequent hooks or the hooked function."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"schema.pre('save', function () {\n // You can also return a promise that rejects\n return new Promise((resolve, reject) => {\n reject(new Error('something went wrong'));\n });\n});\n\nschema.pre('save', function () {\n // You can also throw a synchronous error\n throw new Error('something went wrong');\n});\n\nschema.pre('save', async function () {\n await Promise.resolve();\n // You can also throw an error in an `async` function\n throw new Error('something went wrong');\n});\n\n// later...\n\n// Changes will not be persisted to Couchbase Server because a pre hook errored out\ntry {\n await myDoc.save();\n} catch (e) {\n console.log(e.message); // something went wrong\n}\n")),(0,o.kt)("h3",{id:"post-hooks"},"Post Hooks"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"post")," middleware is executed after the hooked method and all of its pre hooks have been completed."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"schema.post('validate', function (doc) {\n console.log('%s has been validated (but not saved yet)', doc.id);\n});\nschema.post('save', function (doc) {\n console.log('%s has been saved', doc.id);\n});\nschema.post('remove', function (doc) {\n console.log('%s has been removed', doc.id);\n});\n")),(0,o.kt)("h3",{id:"define-hooks-before-compiling-models"},"Define Hooks Before Compiling Models"),(0,o.kt)("p",null,"Calling ",(0,o.kt)("inlineCode",{parentName:"p"},"pre()")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"post()")," after compiling a model does not work in Ottoman in general. For example, the below ",(0,o.kt)("inlineCode",{parentName:"p"},"pre('save')")," hook will not fire."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const schema = new Schema({ name: String });\n\n// Compile a model from the schema\nconst User = model('User', schema);\n\n// Ottoman will **not** call the middleware function, because\n// this hook was defined after the model was compiled\nschema.pre('save', () => console.log('Hello from pre save'));\n\nnew User({ name: 'test' }).save();\n")),(0,o.kt)("h3",{id:"savevalidate-hooks"},"Save/Validate Hooks"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"save()")," function triggers ",(0,o.kt)("inlineCode",{parentName:"p"},"validate()")," hooks, because Ottoman has a built-in ",(0,o.kt)("inlineCode",{parentName:"p"},"pre('save')")," hook that calls ",(0,o.kt)("inlineCode",{parentName:"p"},"validate()"),". This means that all ",(0,o.kt)("inlineCode",{parentName:"p"},"pre('validate')")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"post('validate')")," hooks get called before any ",(0,o.kt)("inlineCode",{parentName:"p"},"pre('save')")," hooks. The ",(0,o.kt)("inlineCode",{parentName:"p"},"updateById()")," function have the same behavior."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"schema.pre('validate', function () {\n console.log('this gets printed first');\n});\nschema.post('validate', function () {\n console.log('this gets printed second');\n});\nschema.pre('save', function () {\n console.log('this gets printed third');\n});\nschema.post('save', function () {\n console.log('this gets printed fourth');\n});\n")),(0,o.kt)("h2",{id:"plugins"},"Plugins"),(0,o.kt)("p",null,"Schemas are pluggable, that is, they allow for applying pre-packaged capabilities to extend their functionality. This is a very powerful feature."),(0,o.kt)("h3",{id:"plugin-example"},"Plugin Example"),(0,o.kt)("p",null,"Plugins are a tool for reusing logic in multiple schemas. Suppose you have several models in your database and want to add a function to log all doc before save. Just create a plugin once and apply it to each Schema using the ",(0,o.kt)("inlineCode",{parentName:"p"},"plugin")," function:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const pluginLog = (schema) => {\n schema.pre('save', function (doc) {\n console.log(doc)\n });\n};\n\nconst UserSchema = new Schema({\n isActive: Boolean,\n name: String\n});\n\nUserSchema.plugin(pluginLog)\n\nconst UserModel = model('User', UserSchema);\n\nconst user = new UserModel(...);\n// Pre save hooks will be executed and it will print the document just before persisting to Couchbase Server\nawait user.save();\n")),(0,o.kt)("h3",{id:"global-plugins"},"Global Plugins"),(0,o.kt)("p",null,"Want to register a plugin for all schemas? The Ottoman ",(0,o.kt)("inlineCode",{parentName:"p"},"registerGlobalPlugin")," function registers a plugin for every schema. For example:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { registerGlobalPlugin } from 'ottoman';\n\nconst pluginLog = (schema) => {\n schema.pre('save', function (doc) {\n console.log(doc)\n });\n};\n\nregisterGlobalPlugin(pluginLog);\n\nconst UserSchema = new Schema({\n isActive: Boolean,\n name: String\n});\n\nconst UserModel = model('User', UserSchema);\n\nconst user = new UserModel(...);\n// Pre save hooks will be executed and it will print the document just before persisting to Couchbase Server\nawait user.save();\n")),(0,o.kt)("h2",{id:"strict-mode"},"Strict Mode"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"strict")," option (enabled by default) ensures that values passed to our model constructor that were not specified in our schema do not get saved to the database."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const userSchema = new Schema({ ... })\nconst User = model('User', userSchema);\nconst user = new User({ iAmNotInTheSchema: true });\nuser.save(); // iAmNotInTheSchema is not saved to the db\n\n// set to false..\nconst userSchema = new Schema({ ... }, { strict: false });\nconst user = new User({ iAmNotInTheSchema: true });\nuser.save(); // iAmNotInTheSchema is now saved to the db!\n")),(0,o.kt)("p",null,"This value can be overridden at the model instance level by passing as second argument:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const User = model('User', userSchema);\nconst user = new User(doc, { strict: true }); // enables strict mode\nconst user = new User(doc, { strict: false }); // disables strict mode\n")),(0,o.kt)("h2",{id:"schema-types-immutable-option"},"Schema Types Immutable Option"),(0,o.kt)("p",null,"Defines this path as ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable"),". Ottoman prevents you from changing ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," paths allowing, you to safely write untrusted data to Couchbase without any additional validation."),(0,o.kt)("p",null,"With update functions Ottoman also strips updates to ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," properties from ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/interfaces/imodel.html#updatebyid"},"updateById()"),", ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/interfaces/imodel.html#updatemany"},"updateMany()"),", ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/interfaces/imodel.html#replacebyid"},"replaceById()")," and ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/interfaces/imodel.html#findoneandupdate"},"findOneAndUpdate()"),". Your update will succeed if you try to overwrite an ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," property, Ottoman will just strip out the ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," property."),(0,o.kt)("p",null,"Let's see this option in action using ",(0,o.kt)("inlineCode",{parentName:"p"},"findOneAndUpdate")," on ",(0,o.kt)("inlineCode",{parentName:"p"},"immutable")," properties:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// Define base data\nconst cardData = {\n cardNumber: '5678 5678 5678 5678',\n zipCode: '56789',\n};\n\nconst cardDataUpdate = {\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210',\n};\n\n// Define schemas\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\n\n// Create model\nconst Card = model('Card', CardSchema);\n\n// Start Ottoman instance\nconst ottoman = getDefaultInstance();\nawait ottoman.start();\n\n// Initialize data\nconst { id } = await Card.create(cardData);\n")),(0,o.kt)("h3",{id:"immutable-with-strategy-true-default"},"Immutable with strategy ",(0,o.kt)("inlineCode",{parentName:"h3"},"true")," ",(0,o.kt)("strong",{parentName:"h3"},(0,o.kt)("em",{parentName:"strong"},"(default)"))),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"await Card.findOneAndUpdate(\n { cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate,\n { new: true, strict: true }\n);\nconst result = await Card.findById(id);\nconsole.log(result);\n")),(0,o.kt)("p",null,"Since ",(0,o.kt)("inlineCode",{parentName:"p"},"cardNumber")," is immutable, Ottoman ignores the update to ",(0,o.kt)("inlineCode",{parentName:"p"},"cardNumber")," and only ",(0,o.kt)("inlineCode",{parentName:"p"},"zipCode")," changed:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"{\n cardNumber: '5678 5678 5678 5678',\n zipCode: '43210'\n}\n")),(0,o.kt)("h3",{id:"immutable-with-strategy-false"},"Immutable with strategy ",(0,o.kt)("inlineCode",{parentName:"h3"},"false")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"await Card.findOneAndUpdate(\n { cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate,\n { new: true, strict: false }\n);\nconst result = await Card.findById(id);\nconsole.log(result);\n")),(0,o.kt)("p",null,"All properties must change:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"{\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210'\n}\n")),(0,o.kt)("h3",{id:"immutable-with-strategy-throw"},"Immutable with strategy ",(0,o.kt)("inlineCode",{parentName:"h3"},"THROW")),(0,o.kt)("p",null,"If ",(0,o.kt)("inlineCode",{parentName:"p"},"strict")," is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"THROW"),", Ottoman will throw an error if you try to update ",(0,o.kt)("inlineCode",{parentName:"p"},"cardNumber")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"await Card.findOneAndUpdate(\n { cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate,\n { new: true, strict: CAST_STRATEGY.THROW }\n);\n")),(0,o.kt)("p",null,"will get:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"ImmutableError: Field 'cardNumber' is immutable and current cast strategy is set to 'throw'\n")),(0,o.kt)("p",null,"::: tip NOTE\nOttoman's immutability only applies to ",(0,o.kt)("inlineCode",{parentName:"p"},"document")," that have already been saved to the database."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"// Define schema\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\n// Create model\nconst Card = model('Card', CardSchema);\n// Create document\nconst myCard = new Card({ cardNumber: '4321 4321 4321 4321', zipCode: '43210' });\n// Document is new\nmyCard.$isNew; // true\n\n// can update the document because $isNew: true\nmyCard.cardNumber = '0000 0000 0000 0000';\nmyCard.cardNumber; // '0000 0000 0000 0000'\n\n// now let's save myCard\nconst ottoman = getDefaultInstance();\nawait ottoman.start();\n\nconst myCardSaved = await myCard.save();\n\n// after save\nmyCardSaved.cardNumber = '1111 1111 1111 1111';\nmyCardSaved.cardNumber; // '0000 0000 0000 0000', because `cardNumber` is immutable\n\n// Example with create\nconst myCard2 = await Card.create({\n cardNumber: '4321 4321 4321 4321',\n zipCode: '3232'\n});\nconst myCard3 = await Card.findOne(\n { cardNumber: '4321 4321 4321 4321' }, // filters\n { consistency: SearchConsistency.LOCAL } // options\n);\n\nmyCard2.$isNew; // false\nmyCard3.$isNew; // false\n")),(0,o.kt)("p",null,":::"),(0,o.kt)("h2",{id:"schema-helpful-methods"},"Schema Helpful Methods"),(0,o.kt)("p",null,"Each ",(0,o.kt)("inlineCode",{parentName:"p"},"Schema")," instance has two helpful methods: ",(0,o.kt)("inlineCode",{parentName:"p"},"cast")," and ",(0,o.kt)("inlineCode",{parentName:"p"},"validate"),"."),(0,o.kt)("h3",{id:"cast-method"},"Cast Method"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"cast")," method gets a Javascript Object as the first parameter and enforces schema types for each field in the schema definition."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const schema = new Schema({\n name: String,\n price: Number,\n createdAt: Date\n})\n\nconst result = schema.cast({\n name: 'TV',\n price: '345.99',\n createdAt: '2020-12-20T16:00:00.000Z'\n})\n")),(0,o.kt)("p",null,"Result variable now look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"{\n name: 'TV',\n price: 345.99, // price was casted to Number\n createdAt: 2020-12-20T16:00:00.000Z //createdAt was casted to Date\n}\n")),(0,o.kt)("h4",{id:"cast-method-options"},"Cast Method Options"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"cast")," method have a few useful options:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"interface CastOptions {\n strict?: boolean;\n skip?: string[];\n strategy?: CAST_STRATEGY;\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"strict")," will remove fields not defined in the schema. The default value is set to true."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"skip")," will be a string array with values of the key you may want to prevent to cast. The default value is empty []."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"strategy")," when cast action fails, defined strategy is applied. The default strategy is set to ",(0,o.kt)("inlineCode",{parentName:"li"},"defaultOrDrop"),".")),(0,o.kt)("p",null,"Available strategies are:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"CAST_STRATEGY\n{\n KEEP = 'keep', // will return original value\n drop = 'DROP', // will remove the field\n THROW = 'throw', // will throw an exception\n DEFAULT_OR_DROP = 'defaultOrDrop', // use default or remove the field if no default was provided\n DEFAULT_OR_KEEP = 'defaultOrKeep' // use default or return original value\n}\n")),(0,o.kt)("h3",{id:"validate-method"},"Validate method"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"validate")," method gets a Javascript Object as the first parameter and enforces schema types, rules, and validations for each field in the schema definition. If something fails an exception will be throw up, else the ",(0,o.kt)("inlineCode",{parentName:"p"},"validate")," method will return a valid object for the current Schema."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"const schema = new Schema({\n name: String,\n price: Number,\n createdAt: Date\n})\n\nconst result = schema.validate({\n name: 'TV',\n price: '345.99',\n createdAt: '2020-12-20T16:00:00.000Z'\n})\n")),(0,o.kt)("p",null,"Result variable now looks like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-sh"},"{\n name: 'TV',\n price: 345.99, # price was casted to Number\n createdAt: 2020-12-20T16:00:00.000Z # createdAt was casted to Date\n}\n")),(0,o.kt)("h4",{id:"validate-method-options"},"Validate Method Options"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"validate")," method has 1 option:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"{\n strict: boolean; // strict set to true, will remove field not defined in the schema\n}\n")),(0,o.kt)("p",null,"By default, it will get the ",(0,o.kt)("inlineCode",{parentName:"p"},"strict")," option value set via the Schema constructor."),(0,o.kt)("h2",{id:"extend-schemas"},"Extend Schemas"),(0,o.kt)("h3",{id:"add-method"},"Add Method"),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"add")," method allows adding extra fields or extending properties of other schemas."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"const plane = new Schema({ name: String });\nconst boeing = new Schema({ price: Number });\nboeing.add(plane);\n\n// You can add also add fields to this schema\nboeing.add({ status: Boolean });\n")),(0,o.kt)("p",null,"::: tip\nWhen a schema is added, the following properties are copied: fields, statics, indexes, methods, and hooks. Properties that already exist in the schema (fields, statics, indexes, methods) are overwritten by those of the added schema, except for hooks that are combined.\n:::"),(0,o.kt)("h2",{id:"next-up"},"Next Up"),(0,o.kt)("p",null,"Nice, now we'll can see how ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model"},"Models")," works."))}m.isMDXComponent=!0},4045:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/howToUse-569a5eee66823bc4c5e4346d12eacc6f.jpg"}}]); \ No newline at end of file diff --git a/assets/js/84d23edd.8aae2d55.js b/assets/js/84d23edd.093f25c3.js similarity index 91% rename from assets/js/84d23edd.8aae2d55.js rename to assets/js/84d23edd.093f25c3.js index 3c5baeae..dd137f68 100644 --- a/assets/js/84d23edd.8aae2d55.js +++ b/assets/js/84d23edd.093f25c3.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6458],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),m=p(n),u=r,f=m["".concat(d,".").concat(u)]||m[u]||s[u]||i;return n?a.createElement(f,l(l({ref:t},c),{},{components:n})):a.createElement(f,l({ref:t},c))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=m;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>s,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const i={id:"ModelOptions",title:"Interface: ModelOptions",sidebar_label:"ModelOptions",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/ModelOptions",id:"api/interfaces/ModelOptions",title:"Interface: ModelOptions",description:"Properties",source:"@site/docs/api/interfaces/ModelOptions.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/ModelOptions",permalink:"/docs/api/interfaces/ModelOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ModelOptions",title:"Interface: ModelOptions",sidebar_label:"ModelOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IStatusExecution",permalink:"/docs/api/interfaces/IStatusExecution"},next:{title:"UpdateManyOptions",permalink:"/docs/api/interfaces/UpdateManyOptions"}},d={},p=[{value:"Properties",id:"properties",level:2},{value:"collectionName",id:"collectionname",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"idKey",id:"idkey",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"keyGenerator",id:"keygenerator",level:3},{value:"Type declaration",id:"type-declaration",level:4},{value:"Parameters",id:"parameters",level:5},{value:"Returns",id:"returns",level:5},{value:"Defined in",id:"defined-in-2",level:4},{value:"keyGeneratorDelimiter",id:"keygeneratordelimiter",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"modelKey",id:"modelkey",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"scopeName",id:"scopename",level:3},{value:"Defined in",id:"defined-in-6",level:4}],c={toc:p};function s(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"collectionname"},"collectionName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"collectionName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L6"},"model/interfaces/create-model.interface.ts:6")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"idkey"},"idKey"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"idKey"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L8"},"model/interfaces/create-model.interface.ts:8")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"keygenerator"},"keyGenerator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"keyGenerator"),": (",(0,r.kt)("inlineCode",{parentName:"p"},"params"),": { ",(0,r.kt)("inlineCode",{parentName:"p"},"metadata"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ModelMetadata")," }) => ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"type-declaration"},"Type declaration"),(0,r.kt)("p",null,"\u25b8 (",(0,r.kt)("inlineCode",{parentName:"p"},"params"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h5",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params.metadata")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ModelMetadata"))))),(0,r.kt)("h5",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L11"},"model/interfaces/create-model.interface.ts:11")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"keygeneratordelimiter"},"keyGeneratorDelimiter"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"keyGeneratorDelimiter"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L12"},"model/interfaces/create-model.interface.ts:12")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L10"},"model/interfaces/create-model.interface.ts:10")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"modelkey"},"modelKey"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"modelKey"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L9"},"model/interfaces/create-model.interface.ts:9")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scopename"},"scopeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"scopeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L7"},"model/interfaces/create-model.interface.ts:7")))}s.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6458],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),m=p(n),f=r,u=m["".concat(d,".").concat(f)]||m[f]||s[f]||i;return n?a.createElement(u,l(l({ref:t},c),{},{components:n})):a.createElement(u,l({ref:t},c))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=m;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>s,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const i={id:"ModelOptions",title:"Interface: ModelOptions",sidebar_label:"ModelOptions",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/ModelOptions",id:"api/interfaces/ModelOptions",title:"Interface: ModelOptions",description:"Properties",source:"@site/docs/api/interfaces/ModelOptions.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/ModelOptions",permalink:"/docs/api/interfaces/ModelOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ModelOptions",title:"Interface: ModelOptions",sidebar_label:"ModelOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IStatusExecution",permalink:"/docs/api/interfaces/IStatusExecution"},next:{title:"UpdateManyOptions",permalink:"/docs/api/interfaces/UpdateManyOptions"}},d={},p=[{value:"Properties",id:"properties",level:2},{value:"collectionName",id:"collectionname",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"idKey",id:"idkey",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"keyGenerator",id:"keygenerator",level:3},{value:"Type declaration",id:"type-declaration",level:4},{value:"Parameters",id:"parameters",level:5},{value:"Returns",id:"returns",level:5},{value:"Defined in",id:"defined-in-2",level:4},{value:"keyGeneratorDelimiter",id:"keygeneratordelimiter",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"modelKey",id:"modelkey",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"scopeName",id:"scopename",level:3},{value:"Defined in",id:"defined-in-6",level:4}],c={toc:p};function s(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"collectionname"},"collectionName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"collectionName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L6"},"model/interfaces/create-model.interface.ts:6")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"idkey"},"idKey"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"idKey"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L8"},"model/interfaces/create-model.interface.ts:8")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"keygenerator"},"keyGenerator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"keyGenerator"),": (",(0,r.kt)("inlineCode",{parentName:"p"},"params"),": { ",(0,r.kt)("inlineCode",{parentName:"p"},"metadata"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ModelMetadata")," }) => ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"type-declaration"},"Type declaration"),(0,r.kt)("p",null,"\u25b8 (",(0,r.kt)("inlineCode",{parentName:"p"},"params"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h5",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params.metadata")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ModelMetadata"))))),(0,r.kt)("h5",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L11"},"model/interfaces/create-model.interface.ts:11")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"keygeneratordelimiter"},"keyGeneratorDelimiter"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"keyGeneratorDelimiter"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L12"},"model/interfaces/create-model.interface.ts:12")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L10"},"model/interfaces/create-model.interface.ts:10")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"modelkey"},"modelKey"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"modelKey"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L9"},"model/interfaces/create-model.interface.ts:9")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scopename"},"scopeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"scopeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L7"},"model/interfaces/create-model.interface.ts:7")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/8658577b.c3b43029.js b/assets/js/8658577b.5b6ecbca.js similarity index 97% rename from assets/js/8658577b.c3b43029.js rename to assets/js/8658577b.5b6ecbca.js index 067a8da0..29517664 100644 --- a/assets/js/8658577b.c3b43029.js +++ b/assets/js/8658577b.5b6ecbca.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5435],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,y=d["".concat(l,".").concat(m)]||d[m]||c[m]||i;return n?r.createElement(y,o(o({ref:t},u),{},{components:n})):r.createElement(y,o({ref:t},u))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(7462),a=(n(7294),n(3905));const i={id:"IManyQueryResponse",title:"Interface: IManyQueryResponse",sidebar_label:"IManyQueryResponse",sidebar_position:0,custom_edit_url:null},o=void 0,s={unversionedId:"api/interfaces/IManyQueryResponse",id:"api/interfaces/IManyQueryResponse",title:"Interface: IManyQueryResponse",description:"Type parameters",source:"@site/docs/api/interfaces/IManyQueryResponse.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IManyQueryResponse",permalink:"/docs/api/interfaces/IManyQueryResponse",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IManyQueryResponse",title:"Interface: IManyQueryResponse",sidebar_label:"IManyQueryResponse",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IIndexWithParams",permalink:"/docs/api/interfaces/IIndexWithParams"},next:{title:"IModel",permalink:"/docs/api/interfaces/IModel"}},l={},p=[{value:"Type parameters",id:"type-parameters",level:2},{value:"Implemented by",id:"implemented-by",level:2},{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"status",id:"status",level:3},{value:"Defined in",id:"defined-in-1",level:4}],u={toc:p};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"type-parameters"},"Type parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"T")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"any"))))),(0,a.kt)("h2",{id:"implemented-by"},"Implemented by"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/docs/api/classes/ManyQueryResponse"},(0,a.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")))),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"message"},"message"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"message"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"ManyResponse"),"<",(0,a.kt)("inlineCode",{parentName:"p"},"T"),">"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/types.ts#L63"},"handler/types.ts:63")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"status"},"status"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"status"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Status")),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/types.ts#L62"},"handler/types.ts:62")))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5435],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),p=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=p(e.components);return r.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=p(n),m=a,y=d["".concat(l,".").concat(m)]||d[m]||c[m]||i;return n?r.createElement(y,o(o({ref:t},u),{},{components:n})):r.createElement(y,o({ref:t},u))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>c,frontMatter:()=>i,metadata:()=>s,toc:()=>p});var r=n(7462),a=(n(7294),n(3905));const i={id:"IManyQueryResponse",title:"Interface: IManyQueryResponse",sidebar_label:"IManyQueryResponse",sidebar_position:0,custom_edit_url:null},o=void 0,s={unversionedId:"api/interfaces/IManyQueryResponse",id:"api/interfaces/IManyQueryResponse",title:"Interface: IManyQueryResponse",description:"Type parameters",source:"@site/docs/api/interfaces/IManyQueryResponse.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IManyQueryResponse",permalink:"/docs/api/interfaces/IManyQueryResponse",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IManyQueryResponse",title:"Interface: IManyQueryResponse",sidebar_label:"IManyQueryResponse",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IIndexWithParams",permalink:"/docs/api/interfaces/IIndexWithParams"},next:{title:"IModel",permalink:"/docs/api/interfaces/IModel"}},l={},p=[{value:"Type parameters",id:"type-parameters",level:2},{value:"Implemented by",id:"implemented-by",level:2},{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"status",id:"status",level:3},{value:"Defined in",id:"defined-in-1",level:4}],u={toc:p};function c(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"type-parameters"},"Type parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"T")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"any"))))),(0,a.kt)("h2",{id:"implemented-by"},"Implemented by"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/docs/api/classes/ManyQueryResponse"},(0,a.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")))),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"message"},"message"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"message"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"ManyResponse"),"<",(0,a.kt)("inlineCode",{parentName:"p"},"T"),">"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/types.ts#L63"},"handler/types.ts:63")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"status"},"status"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"status"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Status")),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/types.ts#L62"},"handler/types.ts:62")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/918b2342.80ce61f8.js b/assets/js/918b2342.df516fa9.js similarity index 83% rename from assets/js/918b2342.80ce61f8.js rename to assets/js/918b2342.df516fa9.js index d1c6a7ae..418f081c 100644 --- a/assets/js/918b2342.80ce61f8.js +++ b/assets/js/918b2342.df516fa9.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3313],{3905:(e,t,n)=>{n.d(t,{Zo:()=>i,kt:()=>c});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},i=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,i=s(e,["components","mdxType","originalType","parentName"]),u=p(n),c=r,k=u["".concat(d,".").concat(c)]||u[c]||m[c]||l;return n?a.createElement(k,o(o({ref:t},i),{},{components:n})):a.createElement(k,o({ref:t},i))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=u;var s={};for(var d in t)hasOwnProperty.call(t,d)&&(s[d]=t[d]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const l={id:"Document",title:"Class: Document",sidebar_label:"Document",sidebar_position:0,custom_edit_url:null},o=void 0,s={unversionedId:"api/classes/Document",id:"api/classes/Document",title:"Class: Document",description:"Document class represents a database document and provides useful methods to work with.",source:"@site/docs/api/classes/Document.md",sourceDirName:"api/classes",slug:"/api/classes/Document",permalink:"/docs/api/classes/Document",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Document",title:"Class: Document",sidebar_label:"Document",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"DateType",permalink:"/docs/api/classes/DateType"},next:{title:"EmbedType",permalink:"/docs/api/classes/EmbedType"}},d={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Indexable",id:"indexable",level:2},{value:"Accessors",id:"accessors",level:2},{value:"$isNew",id:"isnew",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Methods",id:"methods",level:2},{value:"_applyData",id:"_applydata",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"_depopulate",id:"_depopulate",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"_getId",id:"_getid",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"_getIdField",id:"_getidfield",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"_populate",id:"_populate",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"_populated",id:"_populated",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"_validate",id:"_validate",level:3},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"remove",id:"remove",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"save",id:"save",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"toJSON",id:"tojson",level:3},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"toObject",id:"toobject",level:3},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-11",level:4}],i={toc:p};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Document class represents a database document and provides useful methods to work with."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'import { connect, model } from "ottoman";\nconnect("couchbase://localhost/travel-sample@admin:password");\n\n// Create an `User` model\nconst User = model(\'User\', { name: String });\n\n// Create a document from the `User` Model\nconst jane = new User({ name: "Jane Doe" })\n')),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Document"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model"))))),(0,r.kt)("h2",{id:"indexable"},"Indexable"),(0,r.kt)("p",null,"\u25aa ","[key: ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"]",": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"isnew"},"$isNew"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"$isNew"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Boolean flag specifying if the document is new."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\n\n// Create model\nconst Card = model('Card', CardSchema);\n\n// Create document\nconst myCard = new Card({ cardNumber: '4321 4321 4321 4321', zipCode: '43210' });\nmyCard.$isNew; // true\n\n// Save document\nconst myCardSaved = await myCard.save();\nmyCardSaved.$isNew; // false\n")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L612"},"model/document.ts:612")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_applydata"},"_","applyData"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_applyData"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",null,"Allows to easily apply data from an object to current document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const user = new User({ name: "John Doe" });\n\nuser._applyData({ name: "Jane Doe" });\nconsole.log(user) // { name: "Jane Doe" }\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"With strategies on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const User = model('Card', { name: { type: String, immutable: true } });\nconst user = new User({ name: 'John Doe' });\n\n // with strategy:false is like above example\n user._applyData({ name: 'Jane Doe' }, false);\n console.log(user); // { name: \"Jane Doe\" }\n\n // with strategy:true remains immutable\n user._applyData({ name: 'Jane Doe' }, true);\n console.log(user); // { name: \"John Doe\" }\n\n // trying to update it directly\n user.name = 'Jane Doe';\n console.log(user); // { name: \"John Doe\" }\n\n // with strategy:CAST_STRATEGY.THROW\n user._applyData({ name: 'Jane Doe' }, CAST_STRATEGY.THROW);\n // ImmutableError: Field 'name' is immutable and current cast strategy is set to 'throw'\n")),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ApplyStrategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L521"},"model/document.ts:521")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_depopulate"},"_","depopulate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_depopulate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldsName"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",null,"Reverts population. Switches back document reference."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"To get in context about the Card and Issue Models ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"see the populate example."),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const card = await Card.findById(cardId);\nconsole.log(card.issues); // ['issueId']\n\nawait card._populate('issues')\nconsole.log(card.issues); // [{ id: 'issueId', title: 'Broken card' }]\n\ncard._depopulate('issues')\nconsole.log(card.issues); // ['issueId']\n")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldsName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L437"},"model/document.ts:437")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_getid"},"_","getId"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_getId"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Returns id value, useful when working with dynamic ID_KEY."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"}," console.log(user._getId()); // 'userId'\n console.log(user.id); // 'userId'\n")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L124"},"model/document.ts:124")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_getidfield"},"_","getIdField"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_getIdField"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Returns id key."),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L131"},"model/document.ts:131")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_populate"},"_","populate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_populate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldsName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document")),">"),(0,r.kt)("p",null,"Allows to load document references."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Getting context to explain populate."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"// Defining the schemas\nconst addressSchema = new Schema({\n address: String,\n});\nconst personSchema = new Schema({\n name: String,\n age: Number,\n address: { type: addressSchema, ref: 'Address' },\n});\nconst companySchema = new Schema({\n president: { type: personSchema, ref: 'Person' },\n ceo: { type: personSchema, ref: 'Person' },\n name: String,\n workers: [{ type: personSchema, ref: 'Person' }],\n});\n\n// Initializing the models\nconst Address = model('Address', addressSchema);\nconst Person = model('Person', personSchema);\nconst Company = model('Company', companySchema);\n\n// Adding some data\nconst johnAddress = await Address.create({ address: '13 Washington Square S, New York, NY 10012, USA' });\nconst john = await Person.create({ name: 'John Smith', age: 52, address: johnAddress });\n\nconst janeAddress = await Address.create({ address: '55 Clark St, Brooklyn, NY 11201, USA' });\nconst jane = await Person.create({ name: 'Jane Doe', age: 45, address: janeAddress });\n\nconst company = await Company.create({ name: 'Space X', president: john, ceo: jane });\n\n// Getting saved company data\nconst spaceX = await Company.findById(company.id);\nconsole.log(`Company: `, company);\n")),(0,r.kt)("p",null,"Will get:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Company: {\n name: 'Space X',\n president: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n ceo: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Now we will see how the _populate methods works."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate('ceo');\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n ceo: {\n name: 'Jane Doe',\n age: 45,\n address: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n _type: 'Person'\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Can also pass an array or a string separated by a comma"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate('ceo,president');\n// or\nconst result = await spaceX._populate(['ceo', 'president']);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: {\n name: 'John Smith',\n age: 52,\n address: 'bc7ea8a8-8d1c-4ab6-990c-d3a0163f7e10',\n id: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n _type: 'Person'\n },\n ceo: {\n name: 'Jane Doe',\n age: 45,\n address: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n _type: 'Person'\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"If you want to get only a portion of the object"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate({\n ceo: ['age', 'address'], // or 'age,addres'\n president: 'name',\n});\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: { name: 'John Smith' },\n ceo: { age: 45, address: '235dd441-b445-4b88-b6aa-2ce35a958a32' },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Now let's to go deeper"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate(\n {\n ceo: {\n select: 'age,id', // remember you can use ['age','address']\n populate: 'address', // will populate all the fields\n },\n president: {\n select: 'name',\n populate: {\n address: 'address', // will populate address field only\n },\n },\n },\n 2, // for populate up to the second level\n);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: {\n name: 'John Smith',\n address: { address: '13 Washington Square S, New York, NY 10012, USA' }\n },\n ceo: {\n age: 45,\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n address: {\n address: '55 Clark St, Brooklyn, NY 11201, USA',\n id: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n _type: 'Address'\n }\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Below is another way through the find functions"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await Company.findOne(\n { name: 'Space X' },\n {\n select: 'president,ceo',\n populate: {\n president: { select: 'address,id', populate: 'address' },\n ceo: { select: ['age', 'name'], populate: { address: { select: 'id' } } },\n },\n populateMaxDeep: 2,\n },\n);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n ceo: {\n age: 45,\n name: 'Jane Doe',\n address: { id: '235dd441-b445-4b88-b6aa-2ce35a958a32' }\n },\n president: {\n address: {\n address: '13 Washington Square S, New York, NY 10012, USA',\n id: 'bc7ea8a8-8d1c-4ab6-990c-d3a0163f7e10',\n _type: 'Address'\n },\n id: '50e85ac9-5b4f-4587-aeb6-b287527794c9'\n }\n}\n")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldsName?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"PopulateFieldsType"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"PopulateOptionsType"))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document")),">"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L415"},"model/document.ts:415")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_populated"},"_","populated"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_populated"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldName"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Allows to know if a document field is populated."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"To get in context about the Card and Issue Models ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"see the populate example."),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const card = await Card.findById(cardId);\nconsole.log(card.issues); // ['issueId']\nconsole.log(card._populated('issues')); // false\n\nawait card._populate('issues')\nconsole.log(card.issues); // [{ id: 'issueId', title: 'Broken card' }]\nconsole.log(card._populated('issues')); // true\n")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L477"},"model/document.ts:477")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_validate"},"_","validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_validate"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Runs schema validations over current document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = new User( { name: "John Doe" } );\n\ntry {\n await user._validate()\n} catch(errors) {\n console.log(errors)\n}\n')),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L565"},"model/document.ts:565")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"remove"},"remove"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"remove"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Removes the document from the database."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const user = User.findById('userId')\n\nawait user.remove();\n")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object"))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L205"},"model/document.ts:205")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"save"},"save"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"save"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"onlyCreate?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Saves or Updates the document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = new User({ name: "John Doe" }); //user document created, it\'s not saved yet\n\nawait user.save(); // user saved into the DB\n\n// You also can force save function to only create new Documents by passing true as argument\nawait user.save(true); // ensure to execute a insert operation\n')),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"onlyCreate")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"false"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/saveOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"saveOptions"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"{}"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L148"},"model/document.ts:148")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"tojson"},"toJSON"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"toJSON"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",null,"Returns a Javascript object to be serialized to JSON"),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L579"},"model/document.ts:579")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"toobject"},"toObject"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"toObject"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",null,"Returns a Javascript object with data"),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L572"},"model/document.ts:572")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3313],{3905:(e,t,n)=>{n.d(t,{Zo:()=>i,kt:()=>c});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},i=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,i=s(e,["components","mdxType","originalType","parentName"]),u=p(n),c=r,k=u["".concat(d,".").concat(c)]||u[c]||m[c]||l;return n?a.createElement(k,o(o({ref:t},i),{},{components:n})):a.createElement(k,o({ref:t},i))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,o=new Array(l);o[0]=u;var s={};for(var d in t)hasOwnProperty.call(t,d)&&(s[d]=t[d]);s.originalType=e,s.mdxType="string"==typeof e?e:r,o[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>o,default:()=>m,frontMatter:()=>l,metadata:()=>s,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const l={id:"Document",title:"Class: Document",sidebar_label:"Document",sidebar_position:0,custom_edit_url:null},o=void 0,s={unversionedId:"api/classes/Document",id:"api/classes/Document",title:"Class: Document",description:"Document class represents a database document and provides useful methods to work with.",source:"@site/docs/api/classes/Document.md",sourceDirName:"api/classes",slug:"/api/classes/Document",permalink:"/docs/api/classes/Document",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Document",title:"Class: Document",sidebar_label:"Document",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"DateType",permalink:"/docs/api/classes/DateType"},next:{title:"EmbedType",permalink:"/docs/api/classes/EmbedType"}},d={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Indexable",id:"indexable",level:2},{value:"Accessors",id:"accessors",level:2},{value:"$isNew",id:"isnew",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Methods",id:"methods",level:2},{value:"_applyData",id:"_applydata",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"_depopulate",id:"_depopulate",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"_getId",id:"_getid",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"_getIdField",id:"_getidfield",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"_populate",id:"_populate",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"_populated",id:"_populated",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"_validate",id:"_validate",level:3},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"remove",id:"remove",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"save",id:"save",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"toJSON",id:"tojson",level:3},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"toObject",id:"toobject",level:3},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-11",level:4}],i={toc:p};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},i,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Document class represents a database document and provides useful methods to work with."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'import { connect, model } from "ottoman";\nconnect("couchbase://localhost/travel-sample@admin:password");\n\n// Create an `User` model\nconst User = model(\'User\', { name: String });\n\n// Create a document from the `User` Model\nconst jane = new User({ name: "Jane Doe" })\n')),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Document"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Model"},(0,r.kt)("inlineCode",{parentName:"a"},"Model"))))),(0,r.kt)("h2",{id:"indexable"},"Indexable"),(0,r.kt)("p",null,"\u25aa ","[key: ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"]",": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"isnew"},"$isNew"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"$isNew"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Boolean flag specifying if the document is new."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\n\n// Create model\nconst Card = model('Card', CardSchema);\n\n// Create document\nconst myCard = new Card({ cardNumber: '4321 4321 4321 4321', zipCode: '43210' });\nmyCard.$isNew; // true\n\n// Save document\nconst myCardSaved = await myCard.save();\nmyCardSaved.$isNew; // false\n")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L615"},"model/document.ts:615")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_applydata"},"_","applyData"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_applyData"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",null,"Allows to easily apply data from an object to current document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'const user = new User({ name: "John Doe" });\n\nuser._applyData({ name: "Jane Doe" });\nconsole.log(user) // { name: "Jane Doe" }\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"With strategies on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const User = model('Card', { name: { type: String, immutable: true } });\nconst user = new User({ name: 'John Doe' });\n\n // with strategy:false is like above example\n user._applyData({ name: 'Jane Doe' }, false);\n console.log(user); // { name: \"Jane Doe\" }\n\n // with strategy:true remains immutable\n user._applyData({ name: 'Jane Doe' }, true);\n console.log(user); // { name: \"John Doe\" }\n\n // trying to update it directly\n user.name = 'Jane Doe';\n console.log(user); // { name: \"John Doe\" }\n\n // with strategy:CAST_STRATEGY.THROW\n user._applyData({ name: 'Jane Doe' }, CAST_STRATEGY.THROW);\n // ImmutableError: Field 'name' is immutable and current cast strategy is set to 'throw'\n")),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ApplyStrategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L524"},"model/document.ts:524")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_depopulate"},"_","depopulate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_depopulate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldsName"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",null,"Reverts population. Switches back document reference."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"To get in context about the Card and Issue Models ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"see the populate example."),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const card = await Card.findById(cardId);\nconsole.log(card.issues); // ['issueId']\n\nawait card._populate('issues')\nconsole.log(card.issues); // [{ id: 'issueId', title: 'Broken card' }]\n\ncard._depopulate('issues')\nconsole.log(card.issues); // ['issueId']\n")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldsName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L440"},"model/document.ts:440")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_getid"},"_","getId"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_getId"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Returns id value, useful when working with dynamic ID_KEY."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"}," console.log(user._getId()); // 'userId'\n console.log(user.id); // 'userId'\n")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L124"},"model/document.ts:124")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_getidfield"},"_","getIdField"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_getIdField"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Returns id key."),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L131"},"model/document.ts:131")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_populate"},"_","populate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_populate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldsName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document")),">"),(0,r.kt)("p",null,"Allows to load document references."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Getting context to explain populate."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"// Defining the schemas\nconst addressSchema = new Schema({\n address: String,\n});\nconst personSchema = new Schema({\n name: String,\n age: Number,\n address: { type: addressSchema, ref: 'Address' },\n});\nconst companySchema = new Schema({\n president: { type: personSchema, ref: 'Person' },\n ceo: { type: personSchema, ref: 'Person' },\n name: String,\n workers: [{ type: personSchema, ref: 'Person' }],\n});\n\n// Initializing the models\nconst Address = model('Address', addressSchema);\nconst Person = model('Person', personSchema);\nconst Company = model('Company', companySchema);\n\n// Adding some data\nconst johnAddress = await Address.create({ address: '13 Washington Square S, New York, NY 10012, USA' });\nconst john = await Person.create({ name: 'John Smith', age: 52, address: johnAddress });\n\nconst janeAddress = await Address.create({ address: '55 Clark St, Brooklyn, NY 11201, USA' });\nconst jane = await Person.create({ name: 'Jane Doe', age: 45, address: janeAddress });\n\nconst company = await Company.create({ name: 'Space X', president: john, ceo: jane });\n\n// Getting saved company data\nconst spaceX = await Company.findById(company.id);\nconsole.log(`Company: `, company);\n")),(0,r.kt)("p",null,"Will get:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Company: {\n name: 'Space X',\n president: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n ceo: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Now we will see how the _populate methods works."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate('ceo');\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n ceo: {\n name: 'Jane Doe',\n age: 45,\n address: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n _type: 'Person'\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Can also pass an array or a string separated by a comma"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate('ceo,president');\n// or\nconst result = await spaceX._populate(['ceo', 'president']);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: {\n name: 'John Smith',\n age: 52,\n address: 'bc7ea8a8-8d1c-4ab6-990c-d3a0163f7e10',\n id: '50e85ac9-5b4f-4587-aeb6-b287527794c9',\n _type: 'Person'\n },\n ceo: {\n name: 'Jane Doe',\n age: 45,\n address: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n _type: 'Person'\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"If you want to get only a portion of the object"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate({\n ceo: ['age', 'address'], // or 'age,addres'\n president: 'name',\n});\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: { name: 'John Smith' },\n ceo: { age: 45, address: '235dd441-b445-4b88-b6aa-2ce35a958a32' },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Now let's to go deeper"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await spaceX._populate(\n {\n ceo: {\n select: 'age,id', // remember you can use ['age','address']\n populate: 'address', // will populate all the fields\n },\n president: {\n select: 'name',\n populate: {\n address: 'address', // will populate address field only\n },\n },\n },\n 2, // for populate up to the second level\n);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n name: 'Space X',\n president: {\n name: 'John Smith',\n address: { address: '13 Washington Square S, New York, NY 10012, USA' }\n },\n ceo: {\n age: 45,\n id: '32c2e85a-cc91-4db2-935f-f7d2768168de',\n address: {\n address: '55 Clark St, Brooklyn, NY 11201, USA',\n id: '235dd441-b445-4b88-b6aa-2ce35a958a32',\n _type: 'Address'\n }\n },\n id: 'd59efbdf-4b7e-4d2f-a986-6e8451f22822',\n _type: 'Company'\n}\n")),(0,r.kt)("p",null,"Below is another way through the find functions"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const result = await Company.findOne(\n { name: 'Space X' },\n {\n select: 'president,ceo',\n populate: {\n president: { select: 'address,id', populate: 'address' },\n ceo: { select: ['age', 'name'], populate: { address: { select: 'id' } } },\n },\n populateMaxDeep: 2,\n },\n);\nconsole.log(`Result: `, result);\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"Result: {\n ceo: {\n age: 45,\n name: 'Jane Doe',\n address: { id: '235dd441-b445-4b88-b6aa-2ce35a958a32' }\n },\n president: {\n address: {\n address: '13 Washington Square S, New York, NY 10012, USA',\n id: 'bc7ea8a8-8d1c-4ab6-990c-d3a0163f7e10',\n _type: 'Address'\n },\n id: '50e85ac9-5b4f-4587-aeb6-b287527794c9'\n }\n}\n")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldsName?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"PopulateFieldsType"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"PopulateOptionsType"))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document")),">"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L418"},"model/document.ts:418")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_populated"},"_","populated"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_populated"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"fieldName"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Allows to know if a document field is populated."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"To get in context about the Card and Issue Models ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document.html"},"see the populate example."),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const card = await Card.findById(cardId);\nconsole.log(card.issues); // ['issueId']\nconsole.log(card._populated('issues')); // false\n\nawait card._populate('issues')\nconsole.log(card.issues); // [{ id: 'issueId', title: 'Broken card' }]\nconsole.log(card._populated('issues')); // true\n")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fieldName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L480"},"model/document.ts:480")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_validate"},"_","validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"_validate"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Runs schema validations over current document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = new User( { name: "John Doe" } );\n\ntry {\n await user._validate()\n} catch(errors) {\n console.log(errors)\n}\n')),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L568"},"model/document.ts:568")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"remove"},"remove"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"remove"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Removes the document from the database."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const user = User.findById('userId')\n\nawait user.remove();\n")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"removeOptions"))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L208"},"model/document.ts:208")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"save"},"save"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"save"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"onlyCreate?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Saves or Updates the document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = new User({ name: "John Doe" }); //user document created, it\'s not saved yet\n\nawait user.save(); // user saved into the DB\n\n// You also can force save function to only create new Documents by passing true as argument\nawait user.save(true); // ensure to execute a insert operation\n')),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"onlyCreate")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"false"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/saveOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"saveOptions"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"{}"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L148"},"model/document.ts:148")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"tojson"},"toJSON"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"toJSON"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",null,"Returns a Javascript object to be serialized to JSON"),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L582"},"model/document.ts:582")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"toobject"},"toObject"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"toObject"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("p",null,"Returns a Javascript object with data"),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Document"},(0,r.kt)("inlineCode",{parentName:"a"},"Document"))),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L575"},"model/document.ts:575")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/935f2afb.52983042.js b/assets/js/935f2afb.52983042.js new file mode 100644 index 00000000..574ffc5b --- /dev/null +++ b/assets/js/935f2afb.52983042.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[53],{1109:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Intoduction","href":"/docs/intro","docId":"intro"},{"type":"link","label":"Quickstart","href":"/docs/quick-start","docId":"quick-start"},{"type":"category","label":"Basic","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Schemas","href":"/docs/basic/schema","docId":"basic/schema"},{"type":"link","label":"Models","href":"/docs/basic/model","docId":"basic/model"},{"type":"link","label":"Documents","href":"/docs/basic/document","docId":"basic/document"},{"type":"link","label":"Ottoman Class","href":"/docs/basic/ottoman","docId":"basic/ottoman"},{"type":"link","label":"Query Builder","href":"/docs/basic/query-builder","docId":"basic/query-builder"}]},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Full Text Search","href":"/docs/advanced/fts","docId":"advanced/fts"},{"type":"link","label":"Transactions","href":"/docs/advanced/transactions","docId":"advanced/transactions"},{"type":"link","label":"How Ottoman Works","href":"/docs/advanced/how-ottoman-works","docId":"advanced/how-ottoman-works"},{"type":"link","label":"Advanced Concepts","href":"/docs/advanced/ottoman","docId":"advanced/ottoman"},{"type":"link","label":"Mongoose to Ottoman","href":"/docs/advanced/mongoose-to-couchbase","docId":"advanced/mongoose-to-couchbase"},{"type":"link","label":"Ottoman for Couchbase Node.js SDK developers","href":"/docs/advanced/ottoman-couchbase","docId":"advanced/ottoman-couchbase"},{"type":"link","label":"Ottoman V1 to Ottoman V2","href":"/docs/advanced/ottomanV1-to-ottomanV2","docId":"advanced/ottomanV1-to-ottomanV2"},{"type":"link","label":"Ottoman Vs SDK Comparison","href":"/docs/advanced/sdk-comparison","docId":"advanced/sdk-comparison"}]},{"type":"link","label":"Building Your First App","href":"/docs/first-app","docId":"first-app"},{"type":"link","label":"Command Line Tool","href":"/docs/cli/","docId":"cli/cli"},{"type":"category","label":"API","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Exports","href":"/docs/api/modules","docId":"api/modules"},{"type":"category","label":"Enumerations","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"SearchConsistency","href":"/docs/api/enums/SearchConsistency","docId":"api/enums/SearchConsistency"},{"type":"link","label":"VALIDATION_STRATEGY","href":"/docs/api/enums/VALIDATION_STRATEGY","docId":"api/enums/VALIDATION_STRATEGY"}]},{"type":"category","label":"Classes","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"ArrayType","href":"/docs/api/classes/ArrayType","docId":"api/classes/ArrayType"},{"type":"link","label":"BooleanType","href":"/docs/api/classes/BooleanType","docId":"api/classes/BooleanType"},{"type":"link","label":"BuildSchemaError","href":"/docs/api/classes/BuildSchemaError","docId":"api/classes/BuildSchemaError"},{"type":"link","label":"CoreType","href":"/docs/api/classes/CoreType","docId":"api/classes/CoreType"},{"type":"link","label":"DateType","href":"/docs/api/classes/DateType","docId":"api/classes/DateType"},{"type":"link","label":"Document","href":"/docs/api/classes/Document","docId":"api/classes/Document"},{"type":"link","label":"EmbedType","href":"/docs/api/classes/EmbedType","docId":"api/classes/EmbedType"},{"type":"link","label":"FindByIdOptions","href":"/docs/api/classes/FindByIdOptions","docId":"api/classes/FindByIdOptions"},{"type":"link","label":"FindOptions","href":"/docs/api/classes/FindOptions","docId":"api/classes/FindOptions"},{"type":"link","label":"IOttomanType","href":"/docs/api/classes/IOttomanType","docId":"api/classes/IOttomanType"},{"type":"link","label":"IndexParamsOnExceptions","href":"/docs/api/classes/IndexParamsOnExceptions","docId":"api/classes/IndexParamsOnExceptions"},{"type":"link","label":"IndexParamsUsingGSIExceptions","href":"/docs/api/classes/IndexParamsUsingGSIExceptions","docId":"api/classes/IndexParamsUsingGSIExceptions"},{"type":"link","label":"ManyQueryResponse","href":"/docs/api/classes/ManyQueryResponse","docId":"api/classes/ManyQueryResponse"},{"type":"link","label":"MixedType","href":"/docs/api/classes/MixedType","docId":"api/classes/MixedType"},{"type":"link","label":"Model","href":"/docs/api/classes/Model","docId":"api/classes/Model"},{"type":"link","label":"MultipleQueryTypesException","href":"/docs/api/classes/MultipleQueryTypesException","docId":"api/classes/MultipleQueryTypesException"},{"type":"link","label":"NumberType","href":"/docs/api/classes/NumberType","docId":"api/classes/NumberType"},{"type":"link","label":"Ottoman","href":"/docs/api/classes/Ottoman","docId":"api/classes/Ottoman"},{"type":"link","label":"Query","href":"/docs/api/classes/Query","docId":"api/classes/Query"},{"type":"link","label":"QueryGroupByParamsException","href":"/docs/api/classes/QueryGroupByParamsException","docId":"api/classes/QueryGroupByParamsException"},{"type":"link","label":"QueryOperatorNotFoundException","href":"/docs/api/classes/QueryOperatorNotFoundException","docId":"api/classes/QueryOperatorNotFoundException"},{"type":"link","label":"ReferenceType","href":"/docs/api/classes/ReferenceType","docId":"api/classes/ReferenceType"},{"type":"link","label":"Schema","href":"/docs/api/classes/Schema","docId":"api/classes/Schema"},{"type":"link","label":"SelectClauseException","href":"/docs/api/classes/SelectClauseException","docId":"api/classes/SelectClauseException"},{"type":"link","label":"StringType","href":"/docs/api/classes/StringType","docId":"api/classes/StringType"},{"type":"link","label":"ValidationError","href":"/docs/api/classes/ValidationError","docId":"api/classes/ValidationError"},{"type":"link","label":"ViewIndexOptions","href":"/docs/api/classes/ViewIndexOptions","docId":"api/classes/ViewIndexOptions"},{"type":"link","label":"WhereClauseException","href":"/docs/api/classes/WhereClauseException","docId":"api/classes/WhereClauseException"}]},{"type":"category","label":"Interfaces","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"CreateModelOptions","href":"/docs/api/interfaces/CreateModelOptions","docId":"api/interfaces/CreateModelOptions"},{"type":"link","label":"FindOneAndUpdateOption","href":"/docs/api/interfaces/FindOneAndUpdateOption","docId":"api/interfaces/FindOneAndUpdateOption"},{"type":"link","label":"IConditionExpr","href":"/docs/api/interfaces/IConditionExpr","docId":"api/interfaces/IConditionExpr"},{"type":"link","label":"IField","href":"/docs/api/interfaces/IField","docId":"api/interfaces/IField"},{"type":"link","label":"IIndexOnParams","href":"/docs/api/interfaces/IIndexOnParams","docId":"api/interfaces/IIndexOnParams"},{"type":"link","label":"IIndexWithParams","href":"/docs/api/interfaces/IIndexWithParams","docId":"api/interfaces/IIndexWithParams"},{"type":"link","label":"IManyQueryResponse","href":"/docs/api/interfaces/IManyQueryResponse","docId":"api/interfaces/IManyQueryResponse"},{"type":"link","label":"IModel","href":"/docs/api/interfaces/IModel","docId":"api/interfaces/IModel"},{"type":"link","label":"IStatusExecution","href":"/docs/api/interfaces/IStatusExecution","docId":"api/interfaces/IStatusExecution"},{"type":"link","label":"ModelOptions","href":"/docs/api/interfaces/ModelOptions","docId":"api/interfaces/ModelOptions"},{"type":"link","label":"UpdateManyOptions","href":"/docs/api/interfaces/UpdateManyOptions","docId":"api/interfaces/UpdateManyOptions"},{"type":"link","label":"ValidatorOption","href":"/docs/api/interfaces/ValidatorOption","docId":"api/interfaces/ValidatorOption"},{"type":"link","label":"saveOptions","href":"/docs/api/interfaces/saveOptions","docId":"api/interfaces/saveOptions"}]}],"href":"/docs/api/"},{"type":"link","label":"FAQ","href":"/docs/faq","docId":"faq"}]},"docs":{"advanced/fts":{"id":"advanced/fts","title":"Full Text Search","description":"You can use the Full Text Search service (FTS) to create queryable full-text indexes in Couchbase Server.","sidebar":"tutorialSidebar"},"advanced/how-ottoman-works":{"id":"advanced/how-ottoman-works","title":"How Ottoman Works","description":"This section is for those who want to understand how Ottoman works in depth.","sidebar":"tutorialSidebar"},"advanced/mongoose-to-couchbase":{"id":"advanced/mongoose-to-couchbase","title":"Mongoose to Ottoman","description":"Migrate MongoDB to Couchbase","sidebar":"tutorialSidebar"},"advanced/ottoman":{"id":"advanced/ottoman","title":"Advanced Concepts","description":"This section will cover some advanced concepts and options in Ottoman.","sidebar":"tutorialSidebar"},"advanced/ottoman-couchbase":{"id":"advanced/ottoman-couchbase","title":"Ottoman for Couchbase Node.js SDK developers","description":"Ottoman is an Object Data Modeler (ODM) for Couchbase\u2019s Node.js SDK providing JSON schema and validation for NoSQL.","sidebar":"tutorialSidebar"},"advanced/ottomanV1-to-ottomanV2":{"id":"advanced/ottomanV1-to-ottomanV2","title":"Ottoman V1 to Ottoman V2","description":"Ottoman, for Couchbase, is an object document mapper (ODM) that allows you build what your object model would look like,","sidebar":"tutorialSidebar"},"advanced/sdk-comparison":{"id":"advanced/sdk-comparison","title":"Ottoman Vs SDK Comparison","description":"This document outlines subtle differences between Ottoman and Node.js SDK","sidebar":"tutorialSidebar"},"advanced/transactions":{"id":"advanced/transactions","title":"Transactions","description":"A practical guide on using Couchbase Distributed ACID transactions in Ottoman.","sidebar":"tutorialSidebar"},"api/classes/ArrayType":{"id":"api/classes/ArrayType","title":"Class: ArrayType","description":"Array type supports arrays of SchemaTypes and arrays of subdocuments.","sidebar":"tutorialSidebar"},"api/classes/BooleanType":{"id":"api/classes/BooleanType","title":"Class: BooleanType","description":"Boolean are plain JavaScript Boolean.","sidebar":"tutorialSidebar"},"api/classes/BuildSchemaError":{"id":"api/classes/BuildSchemaError","title":"Class: BuildSchemaError","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/CoreType":{"id":"api/classes/CoreType","title":"Class: CoreType","description":"Param","sidebar":"tutorialSidebar"},"api/classes/DateType":{"id":"api/classes/DateType","title":"Class: DateType","description":"Date are plain JavaScript Date.","sidebar":"tutorialSidebar"},"api/classes/Document":{"id":"api/classes/Document","title":"Class: Document","description":"Document class represents a database document and provides useful methods to work with.","sidebar":"tutorialSidebar"},"api/classes/EmbedType":{"id":"api/classes/EmbedType","title":"Class: EmbedType","description":"EmbedType will allow declaration of path as another schema, set type to the sub-schema\'s instance.","sidebar":"tutorialSidebar"},"api/classes/FindByIdOptions":{"id":"api/classes/FindByIdOptions","title":"Class: FindByIdOptions","description":"Constructors","sidebar":"tutorialSidebar"},"api/classes/FindOptions":{"id":"api/classes/FindOptions","title":"Class: FindOptions","description":"Implements","sidebar":"tutorialSidebar"},"api/classes/IndexParamsOnExceptions":{"id":"api/classes/IndexParamsOnExceptions","title":"Class: IndexParamsOnExceptions","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/IndexParamsUsingGSIExceptions":{"id":"api/classes/IndexParamsUsingGSIExceptions","title":"Class: IndexParamsUsingGSIExceptions","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/IOttomanType":{"id":"api/classes/IOttomanType","title":"Class: IOttomanType","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/ManyQueryResponse":{"id":"api/classes/ManyQueryResponse","title":"Class: ManyQueryResponse","description":"Response class for bulk operations.","sidebar":"tutorialSidebar"},"api/classes/MixedType":{"id":"api/classes/MixedType","title":"Class: MixedType","description":"Mixed type supports any Object types, you can change the value to anything else, it can be represented in the following ways:","sidebar":"tutorialSidebar"},"api/classes/Model":{"id":"api/classes/Model","title":"Class: Model","description":"Document class represents a database document and provides useful methods to work with.","sidebar":"tutorialSidebar"},"api/classes/MultipleQueryTypesException":{"id":"api/classes/MultipleQueryTypesException","title":"Class: MultipleQueryTypesException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/NumberType":{"id":"api/classes/NumberType","title":"Class: NumberType","description":"Number are plain JavaScript Number.","sidebar":"tutorialSidebar"},"api/classes/Ottoman":{"id":"api/classes/Ottoman","title":"Class: Ottoman","description":"Constructors","sidebar":"tutorialSidebar"},"api/classes/Query":{"id":"api/classes/Query","title":"Class: Query","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/QueryGroupByParamsException":{"id":"api/classes/QueryGroupByParamsException","title":"Class: QueryGroupByParamsException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/QueryOperatorNotFoundException":{"id":"api/classes/QueryOperatorNotFoundException","title":"Class: QueryOperatorNotFoundException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/ReferenceType":{"id":"api/classes/ReferenceType","title":"Class: ReferenceType","description":"The Reference type creates a relationship between two schemas.","sidebar":"tutorialSidebar"},"api/classes/Schema":{"id":"api/classes/Schema","title":"Class: Schema","description":"Constructors","sidebar":"tutorialSidebar"},"api/classes/SelectClauseException":{"id":"api/classes/SelectClauseException","title":"Class: SelectClauseException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/StringType":{"id":"api/classes/StringType","title":"Class: StringType","description":"String are plain JavaScript String and accepts the following options:","sidebar":"tutorialSidebar"},"api/classes/ValidationError":{"id":"api/classes/ValidationError","title":"Class: ValidationError","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/ViewIndexOptions":{"id":"api/classes/ViewIndexOptions","title":"Class: ViewIndexOptions","description":"Constructors","sidebar":"tutorialSidebar"},"api/classes/WhereClauseException":{"id":"api/classes/WhereClauseException","title":"Class: WhereClauseException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/enums/SearchConsistency":{"id":"api/enums/SearchConsistency","title":"Enumeration: SearchConsistency","description":"Enumeration Members","sidebar":"tutorialSidebar"},"api/enums/VALIDATION_STRATEGY":{"id":"api/enums/VALIDATION_STRATEGY","title":"Enumeration: VALIDATION_STRATEGY","description":"Hooks available","sidebar":"tutorialSidebar"},"api/index":{"id":"api/index","title":"ottoman","description":"CI","sidebar":"tutorialSidebar"},"api/interfaces/CreateModelOptions":{"id":"api/interfaces/CreateModelOptions","title":"Interface: CreateModelOptions","description":"Properties","sidebar":"tutorialSidebar"},"api/interfaces/FindOneAndUpdateOption":{"id":"api/interfaces/FindOneAndUpdateOption","title":"Interface: FindOneAndUpdateOption","description":"Find One and Update Option parameter.","sidebar":"tutorialSidebar"},"api/interfaces/IConditionExpr":{"id":"api/interfaces/IConditionExpr","title":"Interface: IConditionExpr","description":"List of params to build a SELECT clause","sidebar":"tutorialSidebar"},"api/interfaces/IField":{"id":"api/interfaces/IField","title":"Interface: IField","description":"SELECT field structure","sidebar":"tutorialSidebar"},"api/interfaces/IIndexOnParams":{"id":"api/interfaces/IIndexOnParams","title":"Interface: IIndexOnParams","description":"Index ON clause types","sidebar":"tutorialSidebar"},"api/interfaces/IIndexWithParams":{"id":"api/interfaces/IIndexWithParams","title":"Interface: IIndexWithParams","description":"Index WITH clause","sidebar":"tutorialSidebar"},"api/interfaces/IManyQueryResponse":{"id":"api/interfaces/IManyQueryResponse","title":"Interface: IManyQueryResponse","description":"Type parameters","sidebar":"tutorialSidebar"},"api/interfaces/IModel":{"id":"api/interfaces/IModel","title":"Interface: IModel","description":"Constructor to build a model instance based on schema and options.","sidebar":"tutorialSidebar"},"api/interfaces/IStatusExecution":{"id":"api/interfaces/IStatusExecution","title":"Interface: IStatusExecution","description":"Properties","sidebar":"tutorialSidebar"},"api/interfaces/ModelOptions":{"id":"api/interfaces/ModelOptions","title":"Interface: ModelOptions","description":"Properties","sidebar":"tutorialSidebar"},"api/interfaces/saveOptions":{"id":"api/interfaces/saveOptions","title":"Interface: saveOptions","description":"Properties","sidebar":"tutorialSidebar"},"api/interfaces/UpdateManyOptions":{"id":"api/interfaces/UpdateManyOptions","title":"Interface: UpdateManyOptions","description":"Update Many Options parameter","sidebar":"tutorialSidebar"},"api/interfaces/ValidatorOption":{"id":"api/interfaces/ValidatorOption","title":"Interface: ValidatorOption","description":"Properties","sidebar":"tutorialSidebar"},"api/modules":{"id":"api/modules","title":"ottoman","description":"Enumerations","sidebar":"tutorialSidebar"},"basic/document":{"id":"basic/document","title":"Documents","description":"Ottoman documents represent a one-to-one mapping to documents as stored in Couchbase Server. Each document is an instance of its Model.","sidebar":"tutorialSidebar"},"basic/model":{"id":"basic/model","title":"Models","description":"Models are fancy constructors compiled from Schema definitions.","sidebar":"tutorialSidebar"},"basic/ottoman":{"id":"basic/ottoman","title":"Ottoman Class","description":"Defining an Ottoman Instance","sidebar":"tutorialSidebar"},"basic/query-builder":{"id":"basic/query-builder","title":"Query Builder","description":"Query Builder is a flexible tool designed to create N1QL queries by specifying parameters and methods. Query Builder lets you: create queries of unlimited length and complexity without the need to know the syntax of N1QL Queries.","sidebar":"tutorialSidebar"},"basic/schema":{"id":"basic/schema","title":"Schemas","description":"Schema maps to a Couchbase collection and defines the shape of the documents within that collection.","sidebar":"tutorialSidebar"},"cli/cli":{"id":"cli/cli","title":"Ottoman CLI","description":"Goals:","sidebar":"tutorialSidebar"},"faq":{"id":"faq","title":"FAQ","description":"Before getting started with Ottoman, here are some useful questions and answers to what we think may help you get up and running quickly.","sidebar":"tutorialSidebar"},"first-app":{"id":"first-app","title":"Building Your First App","description":"Our goal is to provide you with a demo application to explore how to setup and use Ottoman using best practices.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Intoduction","description":"CI","sidebar":"tutorialSidebar"},"quick-start":{"id":"quick-start","title":"Quickstart","description":"Before we get started with Ottoman and Node JS, we need to ensure you have Couchbase up and running.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/assets/js/935f2afb.b1b2dfd1.js b/assets/js/935f2afb.b1b2dfd1.js deleted file mode 100644 index caccdf05..00000000 --- a/assets/js/935f2afb.b1b2dfd1.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[53],{1109:e=>{e.exports=JSON.parse('{"pluginId":"default","version":"current","label":"Next","banner":null,"badge":false,"noIndex":false,"className":"docs-version-current","isLast":true,"docsSidebars":{"tutorialSidebar":[{"type":"link","label":"Intoduction","href":"/docs/intro","docId":"intro"},{"type":"link","label":"Quickstart","href":"/docs/quick-start","docId":"quick-start"},{"type":"category","label":"Basic","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Schemas","href":"/docs/basic/schema","docId":"basic/schema"},{"type":"link","label":"Models","href":"/docs/basic/model","docId":"basic/model"},{"type":"link","label":"Documents","href":"/docs/basic/document","docId":"basic/document"},{"type":"link","label":"Ottoman Class","href":"/docs/basic/ottoman","docId":"basic/ottoman"},{"type":"link","label":"Query Builder","href":"/docs/basic/query-builder","docId":"basic/query-builder"}]},{"type":"category","label":"Advanced","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Full Text Search","href":"/docs/advanced/fts","docId":"advanced/fts"},{"type":"link","label":"How Ottoman Works","href":"/docs/advanced/how-ottoman-works","docId":"advanced/how-ottoman-works"},{"type":"link","label":"Advanced Concepts","href":"/docs/advanced/ottoman","docId":"advanced/ottoman"},{"type":"link","label":"Mongoose to Ottoman","href":"/docs/advanced/mongoose-to-couchbase","docId":"advanced/mongoose-to-couchbase"},{"type":"link","label":"Ottoman for Couchbase Node.js SDK developers","href":"/docs/advanced/ottoman-couchbase","docId":"advanced/ottoman-couchbase"},{"type":"link","label":"Ottoman V1 to Ottoman V2","href":"/docs/advanced/ottomanV1-to-ottomanV2","docId":"advanced/ottomanV1-to-ottomanV2"},{"type":"link","label":"Ottoman Vs SDK Comparison","href":"/docs/advanced/sdk-comparison","docId":"advanced/sdk-comparison"}]},{"type":"link","label":"Building Your First App","href":"/docs/first-app","docId":"first-app"},{"type":"link","label":"Command Line Tool","href":"/docs/cli/","docId":"cli/cli"},{"type":"category","label":"API","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"Exports","href":"/docs/api/modules","docId":"api/modules"},{"type":"category","label":"Enumerations","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"SearchConsistency","href":"/docs/api/enums/SearchConsistency","docId":"api/enums/SearchConsistency"},{"type":"link","label":"VALIDATION_STRATEGY","href":"/docs/api/enums/VALIDATION_STRATEGY","docId":"api/enums/VALIDATION_STRATEGY"}]},{"type":"category","label":"Classes","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"ArrayType","href":"/docs/api/classes/ArrayType","docId":"api/classes/ArrayType"},{"type":"link","label":"BooleanType","href":"/docs/api/classes/BooleanType","docId":"api/classes/BooleanType"},{"type":"link","label":"BuildSchemaError","href":"/docs/api/classes/BuildSchemaError","docId":"api/classes/BuildSchemaError"},{"type":"link","label":"CoreType","href":"/docs/api/classes/CoreType","docId":"api/classes/CoreType"},{"type":"link","label":"DateType","href":"/docs/api/classes/DateType","docId":"api/classes/DateType"},{"type":"link","label":"Document","href":"/docs/api/classes/Document","docId":"api/classes/Document"},{"type":"link","label":"EmbedType","href":"/docs/api/classes/EmbedType","docId":"api/classes/EmbedType"},{"type":"link","label":"FindByIdOptions","href":"/docs/api/classes/FindByIdOptions","docId":"api/classes/FindByIdOptions"},{"type":"link","label":"FindOptions","href":"/docs/api/classes/FindOptions","docId":"api/classes/FindOptions"},{"type":"link","label":"IOttomanType","href":"/docs/api/classes/IOttomanType","docId":"api/classes/IOttomanType"},{"type":"link","label":"IndexParamsOnExceptions","href":"/docs/api/classes/IndexParamsOnExceptions","docId":"api/classes/IndexParamsOnExceptions"},{"type":"link","label":"IndexParamsUsingGSIExceptions","href":"/docs/api/classes/IndexParamsUsingGSIExceptions","docId":"api/classes/IndexParamsUsingGSIExceptions"},{"type":"link","label":"ManyQueryResponse","href":"/docs/api/classes/ManyQueryResponse","docId":"api/classes/ManyQueryResponse"},{"type":"link","label":"MixedType","href":"/docs/api/classes/MixedType","docId":"api/classes/MixedType"},{"type":"link","label":"Model","href":"/docs/api/classes/Model","docId":"api/classes/Model"},{"type":"link","label":"MultipleQueryTypesException","href":"/docs/api/classes/MultipleQueryTypesException","docId":"api/classes/MultipleQueryTypesException"},{"type":"link","label":"NumberType","href":"/docs/api/classes/NumberType","docId":"api/classes/NumberType"},{"type":"link","label":"Ottoman","href":"/docs/api/classes/Ottoman","docId":"api/classes/Ottoman"},{"type":"link","label":"Query","href":"/docs/api/classes/Query","docId":"api/classes/Query"},{"type":"link","label":"QueryGroupByParamsException","href":"/docs/api/classes/QueryGroupByParamsException","docId":"api/classes/QueryGroupByParamsException"},{"type":"link","label":"QueryOperatorNotFoundException","href":"/docs/api/classes/QueryOperatorNotFoundException","docId":"api/classes/QueryOperatorNotFoundException"},{"type":"link","label":"ReferenceType","href":"/docs/api/classes/ReferenceType","docId":"api/classes/ReferenceType"},{"type":"link","label":"Schema","href":"/docs/api/classes/Schema","docId":"api/classes/Schema"},{"type":"link","label":"SelectClauseException","href":"/docs/api/classes/SelectClauseException","docId":"api/classes/SelectClauseException"},{"type":"link","label":"StringType","href":"/docs/api/classes/StringType","docId":"api/classes/StringType"},{"type":"link","label":"ValidationError","href":"/docs/api/classes/ValidationError","docId":"api/classes/ValidationError"},{"type":"link","label":"ViewIndexOptions","href":"/docs/api/classes/ViewIndexOptions","docId":"api/classes/ViewIndexOptions"},{"type":"link","label":"WhereClauseException","href":"/docs/api/classes/WhereClauseException","docId":"api/classes/WhereClauseException"}]},{"type":"category","label":"Interfaces","collapsible":true,"collapsed":true,"items":[{"type":"link","label":"CreateModelOptions","href":"/docs/api/interfaces/CreateModelOptions","docId":"api/interfaces/CreateModelOptions"},{"type":"link","label":"FindOneAndUpdateOption","href":"/docs/api/interfaces/FindOneAndUpdateOption","docId":"api/interfaces/FindOneAndUpdateOption"},{"type":"link","label":"IConditionExpr","href":"/docs/api/interfaces/IConditionExpr","docId":"api/interfaces/IConditionExpr"},{"type":"link","label":"IField","href":"/docs/api/interfaces/IField","docId":"api/interfaces/IField"},{"type":"link","label":"IIndexOnParams","href":"/docs/api/interfaces/IIndexOnParams","docId":"api/interfaces/IIndexOnParams"},{"type":"link","label":"IIndexWithParams","href":"/docs/api/interfaces/IIndexWithParams","docId":"api/interfaces/IIndexWithParams"},{"type":"link","label":"IManyQueryResponse","href":"/docs/api/interfaces/IManyQueryResponse","docId":"api/interfaces/IManyQueryResponse"},{"type":"link","label":"IModel","href":"/docs/api/interfaces/IModel","docId":"api/interfaces/IModel"},{"type":"link","label":"IStatusExecution","href":"/docs/api/interfaces/IStatusExecution","docId":"api/interfaces/IStatusExecution"},{"type":"link","label":"ModelOptions","href":"/docs/api/interfaces/ModelOptions","docId":"api/interfaces/ModelOptions"},{"type":"link","label":"UpdateManyOptions","href":"/docs/api/interfaces/UpdateManyOptions","docId":"api/interfaces/UpdateManyOptions"},{"type":"link","label":"ValidatorOption","href":"/docs/api/interfaces/ValidatorOption","docId":"api/interfaces/ValidatorOption"},{"type":"link","label":"saveOptions","href":"/docs/api/interfaces/saveOptions","docId":"api/interfaces/saveOptions"}]}],"href":"/docs/api/"},{"type":"link","label":"FAQ","href":"/docs/faq","docId":"faq"}]},"docs":{"advanced/fts":{"id":"advanced/fts","title":"Full Text Search","description":"You can use the Full Text Search service (FTS) to create queryable full-text indexes in Couchbase Server.","sidebar":"tutorialSidebar"},"advanced/how-ottoman-works":{"id":"advanced/how-ottoman-works","title":"How Ottoman Works","description":"This section is for those who want to understand how Ottoman works in depth.","sidebar":"tutorialSidebar"},"advanced/mongoose-to-couchbase":{"id":"advanced/mongoose-to-couchbase","title":"Mongoose to Ottoman","description":"Migrate MongoDB to Couchbase","sidebar":"tutorialSidebar"},"advanced/ottoman":{"id":"advanced/ottoman","title":"Advanced Concepts","description":"This section will cover some advanced concepts and options in Ottoman.","sidebar":"tutorialSidebar"},"advanced/ottoman-couchbase":{"id":"advanced/ottoman-couchbase","title":"Ottoman for Couchbase Node.js SDK developers","description":"Ottoman is an Object Data Modeler (ODM) for Couchbase\u2019s Node.js SDK providing JSON schema and validation for NoSQL.","sidebar":"tutorialSidebar"},"advanced/ottomanV1-to-ottomanV2":{"id":"advanced/ottomanV1-to-ottomanV2","title":"Ottoman V1 to Ottoman V2","description":"Ottoman, for Couchbase, is an object document mapper (ODM) that allows you build what your object model would look like,","sidebar":"tutorialSidebar"},"advanced/sdk-comparison":{"id":"advanced/sdk-comparison","title":"Ottoman Vs SDK Comparison","description":"This document outlines subtle differences between Ottoman and Node.js SDK","sidebar":"tutorialSidebar"},"api/classes/ArrayType":{"id":"api/classes/ArrayType","title":"Class: ArrayType","description":"Array type supports arrays of SchemaTypes and arrays of subdocuments.","sidebar":"tutorialSidebar"},"api/classes/BooleanType":{"id":"api/classes/BooleanType","title":"Class: BooleanType","description":"Boolean are plain JavaScript Boolean.","sidebar":"tutorialSidebar"},"api/classes/BuildSchemaError":{"id":"api/classes/BuildSchemaError","title":"Class: BuildSchemaError","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/CoreType":{"id":"api/classes/CoreType","title":"Class: CoreType","description":"Param","sidebar":"tutorialSidebar"},"api/classes/DateType":{"id":"api/classes/DateType","title":"Class: DateType","description":"Date are plain JavaScript Date.","sidebar":"tutorialSidebar"},"api/classes/Document":{"id":"api/classes/Document","title":"Class: Document","description":"Document class represents a database document and provides useful methods to work with.","sidebar":"tutorialSidebar"},"api/classes/EmbedType":{"id":"api/classes/EmbedType","title":"Class: EmbedType","description":"EmbedType will allow declaration of path as another schema, set type to the sub-schema\'s instance.","sidebar":"tutorialSidebar"},"api/classes/FindByIdOptions":{"id":"api/classes/FindByIdOptions","title":"Class: FindByIdOptions","description":"Constructors","sidebar":"tutorialSidebar"},"api/classes/FindOptions":{"id":"api/classes/FindOptions","title":"Class: FindOptions","description":"Implements","sidebar":"tutorialSidebar"},"api/classes/IndexParamsOnExceptions":{"id":"api/classes/IndexParamsOnExceptions","title":"Class: IndexParamsOnExceptions","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/IndexParamsUsingGSIExceptions":{"id":"api/classes/IndexParamsUsingGSIExceptions","title":"Class: IndexParamsUsingGSIExceptions","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/IOttomanType":{"id":"api/classes/IOttomanType","title":"Class: IOttomanType","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/ManyQueryResponse":{"id":"api/classes/ManyQueryResponse","title":"Class: ManyQueryResponse","description":"Response class for bulk operations.","sidebar":"tutorialSidebar"},"api/classes/MixedType":{"id":"api/classes/MixedType","title":"Class: MixedType","description":"Mixed type supports any Object types, you can change the value to anything else, it can be represented in the following ways:","sidebar":"tutorialSidebar"},"api/classes/Model":{"id":"api/classes/Model","title":"Class: Model","description":"Document class represents a database document and provides useful methods to work with.","sidebar":"tutorialSidebar"},"api/classes/MultipleQueryTypesException":{"id":"api/classes/MultipleQueryTypesException","title":"Class: MultipleQueryTypesException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/NumberType":{"id":"api/classes/NumberType","title":"Class: NumberType","description":"Number are plain JavaScript Number.","sidebar":"tutorialSidebar"},"api/classes/Ottoman":{"id":"api/classes/Ottoman","title":"Class: Ottoman","description":"Constructors","sidebar":"tutorialSidebar"},"api/classes/Query":{"id":"api/classes/Query","title":"Class: Query","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/QueryGroupByParamsException":{"id":"api/classes/QueryGroupByParamsException","title":"Class: QueryGroupByParamsException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/QueryOperatorNotFoundException":{"id":"api/classes/QueryOperatorNotFoundException","title":"Class: QueryOperatorNotFoundException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/ReferenceType":{"id":"api/classes/ReferenceType","title":"Class: ReferenceType","description":"The Reference type creates a relationship between two schemas.","sidebar":"tutorialSidebar"},"api/classes/Schema":{"id":"api/classes/Schema","title":"Class: Schema","description":"Constructors","sidebar":"tutorialSidebar"},"api/classes/SelectClauseException":{"id":"api/classes/SelectClauseException","title":"Class: SelectClauseException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/StringType":{"id":"api/classes/StringType","title":"Class: StringType","description":"String are plain JavaScript String and accepts the following options:","sidebar":"tutorialSidebar"},"api/classes/ValidationError":{"id":"api/classes/ValidationError","title":"Class: ValidationError","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/classes/ViewIndexOptions":{"id":"api/classes/ViewIndexOptions","title":"Class: ViewIndexOptions","description":"Constructors","sidebar":"tutorialSidebar"},"api/classes/WhereClauseException":{"id":"api/classes/WhereClauseException","title":"Class: WhereClauseException","description":"Hierarchy","sidebar":"tutorialSidebar"},"api/enums/SearchConsistency":{"id":"api/enums/SearchConsistency","title":"Enumeration: SearchConsistency","description":"Enumeration Members","sidebar":"tutorialSidebar"},"api/enums/VALIDATION_STRATEGY":{"id":"api/enums/VALIDATION_STRATEGY","title":"Enumeration: VALIDATION_STRATEGY","description":"Hooks available","sidebar":"tutorialSidebar"},"api/index":{"id":"api/index","title":"ottoman","description":"CI","sidebar":"tutorialSidebar"},"api/interfaces/CreateModelOptions":{"id":"api/interfaces/CreateModelOptions","title":"Interface: CreateModelOptions","description":"Properties","sidebar":"tutorialSidebar"},"api/interfaces/FindOneAndUpdateOption":{"id":"api/interfaces/FindOneAndUpdateOption","title":"Interface: FindOneAndUpdateOption","description":"Find One and Update Option parameter.","sidebar":"tutorialSidebar"},"api/interfaces/IConditionExpr":{"id":"api/interfaces/IConditionExpr","title":"Interface: IConditionExpr","description":"List of params to build a SELECT clause","sidebar":"tutorialSidebar"},"api/interfaces/IField":{"id":"api/interfaces/IField","title":"Interface: IField","description":"SELECT field structure","sidebar":"tutorialSidebar"},"api/interfaces/IIndexOnParams":{"id":"api/interfaces/IIndexOnParams","title":"Interface: IIndexOnParams","description":"Index ON clause types","sidebar":"tutorialSidebar"},"api/interfaces/IIndexWithParams":{"id":"api/interfaces/IIndexWithParams","title":"Interface: IIndexWithParams","description":"Index WITH clause","sidebar":"tutorialSidebar"},"api/interfaces/IManyQueryResponse":{"id":"api/interfaces/IManyQueryResponse","title":"Interface: IManyQueryResponse","description":"Type parameters","sidebar":"tutorialSidebar"},"api/interfaces/IModel":{"id":"api/interfaces/IModel","title":"Interface: IModel","description":"Constructor to build a model instance based on schema and options.","sidebar":"tutorialSidebar"},"api/interfaces/IStatusExecution":{"id":"api/interfaces/IStatusExecution","title":"Interface: IStatusExecution","description":"Properties","sidebar":"tutorialSidebar"},"api/interfaces/ModelOptions":{"id":"api/interfaces/ModelOptions","title":"Interface: ModelOptions","description":"Properties","sidebar":"tutorialSidebar"},"api/interfaces/saveOptions":{"id":"api/interfaces/saveOptions","title":"Interface: saveOptions","description":"Properties","sidebar":"tutorialSidebar"},"api/interfaces/UpdateManyOptions":{"id":"api/interfaces/UpdateManyOptions","title":"Interface: UpdateManyOptions","description":"Update Many Options parameter","sidebar":"tutorialSidebar"},"api/interfaces/ValidatorOption":{"id":"api/interfaces/ValidatorOption","title":"Interface: ValidatorOption","description":"Properties","sidebar":"tutorialSidebar"},"api/modules":{"id":"api/modules","title":"ottoman","description":"Enumerations","sidebar":"tutorialSidebar"},"basic/document":{"id":"basic/document","title":"Documents","description":"Ottoman documents represent a one-to-one mapping to documents as stored in Couchbase Server. Each document is an instance of its Model.","sidebar":"tutorialSidebar"},"basic/model":{"id":"basic/model","title":"Models","description":"Models are fancy constructors compiled from Schema definitions.","sidebar":"tutorialSidebar"},"basic/ottoman":{"id":"basic/ottoman","title":"Ottoman Class","description":"Defining an Ottoman Instance","sidebar":"tutorialSidebar"},"basic/query-builder":{"id":"basic/query-builder","title":"Query Builder","description":"Query Builder is a flexible tool designed to create N1QL queries by specifying parameters and methods. Query Builder lets you: create queries of unlimited length and complexity without the need to know the syntax of N1QL Queries.","sidebar":"tutorialSidebar"},"basic/schema":{"id":"basic/schema","title":"Schemas","description":"Schema maps to a Couchbase collection and defines the shape of the documents within that collection.","sidebar":"tutorialSidebar"},"cli/cli":{"id":"cli/cli","title":"Ottoman CLI","description":"Goals:","sidebar":"tutorialSidebar"},"faq":{"id":"faq","title":"FAQ","description":"Before getting started with Ottoman, here are some useful questions and answers to what we think may help you get up and running quickly.","sidebar":"tutorialSidebar"},"first-app":{"id":"first-app","title":"Building Your First App","description":"Our goal is to provide you with a demo application to explore how to setup and use Ottoman using best practices.","sidebar":"tutorialSidebar"},"intro":{"id":"intro","title":"Intoduction","description":"CI","sidebar":"tutorialSidebar"},"quick-start":{"id":"quick-start","title":"Quickstart","description":"Before we get started with Ottoman and Node JS, we need to ensure you have Couchbase up and running.","sidebar":"tutorialSidebar"}}}')}}]); \ No newline at end of file diff --git a/assets/js/944c12e3.dba4fd59.js b/assets/js/944c12e3.a66501b4.js similarity index 98% rename from assets/js/944c12e3.dba4fd59.js rename to assets/js/944c12e3.a66501b4.js index 92e78555..22502a27 100644 --- a/assets/js/944c12e3.dba4fd59.js +++ b/assets/js/944c12e3.a66501b4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7347],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var r=n(7462),a=(n(7294),n(3905));const o={id:"IndexParamsOnExceptions",title:"Class: IndexParamsOnExceptions",sidebar_label:"IndexParamsOnExceptions",sidebar_position:0,custom_edit_url:null},i=void 0,s={unversionedId:"api/classes/IndexParamsOnExceptions",id:"api/classes/IndexParamsOnExceptions",title:"Class: IndexParamsOnExceptions",description:"Hierarchy",source:"@site/docs/api/classes/IndexParamsOnExceptions.md",sourceDirName:"api/classes",slug:"/api/classes/IndexParamsOnExceptions",permalink:"/docs/api/classes/IndexParamsOnExceptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IndexParamsOnExceptions",title:"Class: IndexParamsOnExceptions",sidebar_label:"IndexParamsOnExceptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IOttomanType",permalink:"/docs/api/classes/IOttomanType"},next:{title:"IndexParamsUsingGSIExceptions",permalink:"/docs/api/classes/IndexParamsUsingGSIExceptions"}},l={},c=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"IndexParamsOnExceptions"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new IndexParamsOnExceptions"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"clause"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"clause")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/exceptions.ts#L45"},"query/exceptions.ts:45")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7347],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function i(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,o=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||o;return n?r.createElement(f,i(i({ref:t},p),{},{components:n})):r.createElement(f,i({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=n.length,i=new Array(o);i[0]=u;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,i[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var r=n(7462),a=(n(7294),n(3905));const o={id:"IndexParamsOnExceptions",title:"Class: IndexParamsOnExceptions",sidebar_label:"IndexParamsOnExceptions",sidebar_position:0,custom_edit_url:null},i=void 0,s={unversionedId:"api/classes/IndexParamsOnExceptions",id:"api/classes/IndexParamsOnExceptions",title:"Class: IndexParamsOnExceptions",description:"Hierarchy",source:"@site/docs/api/classes/IndexParamsOnExceptions.md",sourceDirName:"api/classes",slug:"/api/classes/IndexParamsOnExceptions",permalink:"/docs/api/classes/IndexParamsOnExceptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IndexParamsOnExceptions",title:"Class: IndexParamsOnExceptions",sidebar_label:"IndexParamsOnExceptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IOttomanType",permalink:"/docs/api/classes/IOttomanType"},next:{title:"IndexParamsUsingGSIExceptions",permalink:"/docs/api/classes/IndexParamsUsingGSIExceptions"}},l={},c=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"IndexParamsOnExceptions"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new IndexParamsOnExceptions"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"clause"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"clause")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/exceptions.ts#L45"},"query/exceptions.ts:45")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/95142d39.67d9f846.js b/assets/js/95142d39.67d9f846.js new file mode 100644 index 00000000..5b057b8d --- /dev/null +++ b/assets/js/95142d39.67d9f846.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3128],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>u});var i=t(7294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var d=i.createContext({}),p=function(e){var n=i.useContext(d),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},s=function(e){var n=p(e.components);return i.createElement(d.Provider,{value:n},e.children)},f={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},c=i.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,d=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=p(t),u=r,m=c["".concat(d,".").concat(u)]||c[u]||f[u]||a;return t?i.createElement(m,l(l({ref:n},s),{},{components:t})):i.createElement(m,l({ref:n},s))}));function u(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,l=new Array(a);l[0]=c;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var p=2;p{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>a,metadata:()=>o,toc:()=>p});var i=t(7462),r=(t(7294),t(3905));const a={id:"FindOneAndUpdateOption",title:"Interface: FindOneAndUpdateOption",sidebar_label:"FindOneAndUpdateOption",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/FindOneAndUpdateOption",id:"api/interfaces/FindOneAndUpdateOption",title:"Interface: FindOneAndUpdateOption",description:"Find One and Update Option parameter.",source:"@site/docs/api/interfaces/FindOneAndUpdateOption.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/FindOneAndUpdateOption",permalink:"/docs/api/interfaces/FindOneAndUpdateOption",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"FindOneAndUpdateOption",title:"Interface: FindOneAndUpdateOption",sidebar_label:"FindOneAndUpdateOption",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"CreateModelOptions",permalink:"/docs/api/interfaces/CreateModelOptions"},next:{title:"IConditionExpr",permalink:"/docs/api/interfaces/IConditionExpr"}},d={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:"consistency",id:"consistency",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"ignoreCase",id:"ignorecase",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"lean",id:"lean",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"limit",id:"limit",level:3},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"new",id:"new",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"noCollection",id:"nocollection",level:3},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"populate",id:"populate",level:3},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"populateMaxDeep",id:"populatemaxdeep",level:3},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"select",id:"select",level:3},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"skip",id:"skip",level:3},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"sort",id:"sort",level:3},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"strict",id:"strict",level:3},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"transactionContext",id:"transactioncontext",level:3},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"upsert",id:"upsert",level:3},{value:"Defined in",id:"defined-in-15",level:4}],s={toc:p};function f(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,i.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Find One and Update Option parameter."),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"IFindOptions"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"FindOneAndUpdateOption"))))),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"consistency"},"consistency"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"consistency"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/enums/SearchConsistency"},(0,r.kt)("inlineCode",{parentName:"a"},"SearchConsistency"))),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.consistency"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L41"},"handler/find/find-options.ts:41")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,r.kt)("p",null,"Default: false\nenforceRefCheck will check if the referenced document exists\nset to true: will log a warning message.\nset to 'throw': will throw an exception."),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,"MutationFunctionOptions.enforceRefCheck"),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/find.interface.ts#L24"},"model/interfaces/find.interface.ts:24")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"ignorecase"},"ignoreCase"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"ignoreCase"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.ignoreCase"),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L44"},"handler/find/find-options.ts:44")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"lean"},"lean"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"lean"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.lean"),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L43"},"handler/find/find-options.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"limit"},"limit"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"limit"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.limit"),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L36"},"handler/find/find-options.ts:36")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,"MutationFunctionOptions.maxExpiry"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/find.interface.ts#L17"},"model/interfaces/find.interface.ts:17")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"new"},"new"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"new"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Default: false\nif true, return a document after update otherwise return the document before update."),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/find.interface.ts#L16"},"model/interfaces/find.interface.ts:16")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"nocollection"},"noCollection"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"noCollection"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.noCollection"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L42"},"handler/find/find-options.ts:42")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"populate"},"populate"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"populate"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"PopulateFieldsType")),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.populate"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L38"},"handler/find/find-options.ts:38")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"populatemaxdeep"},"populateMaxDeep"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"populateMaxDeep"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.populateMaxDeep"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L39"},"handler/find/find-options.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"select"},"select"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"select"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[] ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.select"),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L40"},"handler/find/find-options.ts:40")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"skip"},"skip"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"skip"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.skip"),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L35"},"handler/find/find-options.ts:35")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sort"},"sort"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"sort"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,r.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.sort"),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/find/find-options.ts#L37"},"handler/find/find-options.ts:37")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"strict"},"strict"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"strict"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ApplyStrategy")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,"MutationFunctionOptions.strict"),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/cast-strategy.ts#L52"},"utils/cast-strategy.ts:52")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"transactioncontext"},"transactionContext"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"transactionContext"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"TransactionAttemptContext")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,"MutationFunctionOptions.transactionContext"),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/find.interface.ts#L25"},"model/interfaces/find.interface.ts:25")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"upsert"},"upsert"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"upsert"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Default: false\nif true, and no documents found, insert a new document."),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/find.interface.ts#L12"},"model/interfaces/find.interface.ts:12")))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/95142d39.fe79119d.js b/assets/js/95142d39.fe79119d.js deleted file mode 100644 index df756feb..00000000 --- a/assets/js/95142d39.fe79119d.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3128],{3905:(e,n,t)=>{t.d(n,{Zo:()=>s,kt:()=>u});var i=t(7294);function r(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);n&&(i=i.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,i)}return t}function l(e){for(var n=1;n=0||(r[t]=e[t]);return r}(e,n);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(r[t]=e[t])}return r}var d=i.createContext({}),p=function(e){var n=i.useContext(d),t=n;return e&&(t="function"==typeof e?e(n):l(l({},n),e)),t},s=function(e){var n=p(e.components);return i.createElement(d.Provider,{value:n},e.children)},f={inlineCode:"code",wrapper:function(e){var n=e.children;return i.createElement(i.Fragment,{},n)}},c=i.forwardRef((function(e,n){var t=e.components,r=e.mdxType,a=e.originalType,d=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),c=p(t),u=r,m=c["".concat(d,".").concat(u)]||c[u]||f[u]||a;return t?i.createElement(m,l(l({ref:n},s),{},{components:t})):i.createElement(m,l({ref:n},s))}));function u(e,n){var t=arguments,r=n&&n.mdxType;if("string"==typeof e||r){var a=t.length,l=new Array(a);l[0]=c;var o={};for(var d in n)hasOwnProperty.call(n,d)&&(o[d]=n[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var p=2;p{t.r(n),t.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>f,frontMatter:()=>a,metadata:()=>o,toc:()=>p});var i=t(7462),r=(t(7294),t(3905));const a={id:"FindOneAndUpdateOption",title:"Interface: FindOneAndUpdateOption",sidebar_label:"FindOneAndUpdateOption",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/FindOneAndUpdateOption",id:"api/interfaces/FindOneAndUpdateOption",title:"Interface: FindOneAndUpdateOption",description:"Find One and Update Option parameter.",source:"@site/docs/api/interfaces/FindOneAndUpdateOption.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/FindOneAndUpdateOption",permalink:"/docs/api/interfaces/FindOneAndUpdateOption",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"FindOneAndUpdateOption",title:"Interface: FindOneAndUpdateOption",sidebar_label:"FindOneAndUpdateOption",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"CreateModelOptions",permalink:"/docs/api/interfaces/CreateModelOptions"},next:{title:"IConditionExpr",permalink:"/docs/api/interfaces/IConditionExpr"}},d={},p=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Properties",id:"properties",level:2},{value:"consistency",id:"consistency",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"enforceRefCheck",id:"enforcerefcheck",level:3},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"ignoreCase",id:"ignorecase",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"lean",id:"lean",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"limit",id:"limit",level:3},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"new",id:"new",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"noCollection",id:"nocollection",level:3},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"populate",id:"populate",level:3},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"populateMaxDeep",id:"populatemaxdeep",level:3},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"select",id:"select",level:3},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"skip",id:"skip",level:3},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"sort",id:"sort",level:3},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"strict",id:"strict",level:3},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"upsert",id:"upsert",level:3},{value:"Defined in",id:"defined-in-14",level:4}],s={toc:p};function f(e){let{components:n,...t}=e;return(0,r.kt)("wrapper",(0,i.Z)({},s,t,{components:n,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Find One and Update Option parameter."),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"IFindOptions"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"FindOneAndUpdateOption"))))),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"consistency"},"consistency"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"consistency"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/enums/SearchConsistency"},(0,r.kt)("inlineCode",{parentName:"a"},"SearchConsistency"))),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.consistency"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L39"},"handler/find/find-options.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"enforcerefcheck"},"enforceRefCheck"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"enforceRefCheck"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"throw"')),(0,r.kt)("p",null,"Default: false\nenforceRefCheck will check if the referenced document exists\nset to true: will log a warning message.\nset to 'throw': will throw an exception."),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,"MutationFunctionOptions.enforceRefCheck"),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/find.interface.ts#L23"},"model/interfaces/find.interface.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"ignorecase"},"ignoreCase"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"ignoreCase"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.ignoreCase"),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L42"},"handler/find/find-options.ts:42")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"lean"},"lean"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"lean"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.lean"),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L41"},"handler/find/find-options.ts:41")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"limit"},"limit"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"limit"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.limit"),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L34"},"handler/find/find-options.ts:34")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,"MutationFunctionOptions.maxExpiry"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/find.interface.ts#L16"},"model/interfaces/find.interface.ts:16")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"new"},"new"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"new"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Default: false\nif true, return a document after update otherwise return the document before update."),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/find.interface.ts#L15"},"model/interfaces/find.interface.ts:15")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"nocollection"},"noCollection"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"noCollection"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.noCollection"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L40"},"handler/find/find-options.ts:40")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"populate"},"populate"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"populate"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"PopulateFieldsType")),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.populate"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L36"},"handler/find/find-options.ts:36")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"populatemaxdeep"},"populateMaxDeep"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"populateMaxDeep"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.populateMaxDeep"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L37"},"handler/find/find-options.ts:37")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"select"},"select"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"select"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[] ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.select"),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L38"},"handler/find/find-options.ts:38")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"skip"},"skip"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"skip"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.skip"),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L33"},"handler/find/find-options.ts:33")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sort"},"sort"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"sort"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,r.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,"IFindOptions.sort"),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/find/find-options.ts#L35"},"handler/find/find-options.ts:35")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"strict"},"strict"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"strict"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ApplyStrategy")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,"MutationFunctionOptions.strict"),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/cast-strategy.ts#L51"},"utils/cast-strategy.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"upsert"},"upsert"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"upsert"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Default: false\nif true, and no documents found, insert a new document."),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/find.interface.ts#L11"},"model/interfaces/find.interface.ts:11")))}f.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9c1d2067.10bbc8f3.js b/assets/js/9c1d2067.6bdd769a.js similarity index 95% rename from assets/js/9c1d2067.10bbc8f3.js rename to assets/js/9c1d2067.6bdd769a.js index 1b2ae7f5..5537921a 100644 --- a/assets/js/9c1d2067.10bbc8f3.js +++ b/assets/js/9c1d2067.6bdd769a.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3330],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>u});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var o=n.createContext({}),s=function(e){var t=n.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=s(e.components);return n.createElement(o.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),c=s(a),u=r,k=c["".concat(o,".").concat(u)]||c[u]||m[u]||i;return a?n.createElement(k,l(l({ref:t},d),{},{components:a})):n.createElement(k,l({ref:t},d))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=c;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var s=2;s{a.r(t),a.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>s});var n=a(7462),r=(a(7294),a(3905));const i={id:"IOttomanType",title:"Class: IOttomanType",sidebar_label:"IOttomanType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/IOttomanType",id:"api/classes/IOttomanType",title:"Class: IOttomanType",description:"Hierarchy",source:"@site/docs/api/classes/IOttomanType.md",sourceDirName:"api/classes",slug:"/api/classes/IOttomanType",permalink:"/docs/api/classes/IOttomanType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IOttomanType",title:"Class: IOttomanType",sidebar_label:"IOttomanType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"FindOptions",permalink:"/docs/api/classes/FindOptions"},next:{title:"IndexParamsOnExceptions",permalink:"/docs/api/classes/IndexParamsOnExceptions"}},o={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"typeName",id:"typename",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"Methods",id:"methods",level:2},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-4",level:4}],d={toc:s};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"IOttomanType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Protected")," ",(0,r.kt)("strong",{parentName:"p"},"new IOttomanType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"typeName"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"typeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Abstract")," ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY"))))),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L52"},"schema/interfaces/schema.types.ts:52")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Abstract")," ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strict?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean"))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L53"},"schema/interfaces/schema.types.ts:53")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3330],{3905:(e,t,a)=>{a.d(t,{Zo:()=>d,kt:()=>u});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var o=n.createContext({}),s=function(e){var t=n.useContext(o),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},d=function(e){var t=s(e.components);return n.createElement(o.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},c=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,o=e.parentName,d=p(e,["components","mdxType","originalType","parentName"]),c=s(a),u=r,k=c["".concat(o,".").concat(u)]||c[u]||m[u]||i;return a?n.createElement(k,l(l({ref:t},d),{},{components:a})):n.createElement(k,l({ref:t},d))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=c;var p={};for(var o in t)hasOwnProperty.call(t,o)&&(p[o]=t[o]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var s=2;s{a.r(t),a.d(t,{assets:()=>o,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>s});var n=a(7462),r=(a(7294),a(3905));const i={id:"IOttomanType",title:"Class: IOttomanType",sidebar_label:"IOttomanType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/IOttomanType",id:"api/classes/IOttomanType",title:"Class: IOttomanType",description:"Hierarchy",source:"@site/docs/api/classes/IOttomanType.md",sourceDirName:"api/classes",slug:"/api/classes/IOttomanType",permalink:"/docs/api/classes/IOttomanType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IOttomanType",title:"Class: IOttomanType",sidebar_label:"IOttomanType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"FindOptions",permalink:"/docs/api/classes/FindOptions"},next:{title:"IndexParamsOnExceptions",permalink:"/docs/api/classes/IndexParamsOnExceptions"}},o={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"typeName",id:"typename",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"Methods",id:"methods",level:2},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-4",level:4}],d={toc:s};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},d,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"IOttomanType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Protected")," ",(0,r.kt)("strong",{parentName:"p"},"new IOttomanType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"typeName"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"typeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Abstract")," ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY"))))),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L52"},"schema/interfaces/schema.types.ts:52")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Abstract")," ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strict?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean"))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L53"},"schema/interfaces/schema.types.ts:53")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9c253f25.dab688f7.js b/assets/js/9c253f25.27ed8847.js similarity index 98% rename from assets/js/9c253f25.dab688f7.js rename to assets/js/9c253f25.27ed8847.js index 57d1b82a..d38054b5 100644 --- a/assets/js/9c253f25.dab688f7.js +++ b/assets/js/9c253f25.27ed8847.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3910],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||i;return n?r.createElement(f,s(s({ref:t},p),{},{components:n})):r.createElement(f,s({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,s=new Array(i);s[0]=u;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:a,s[1]=o;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var r=n(7462),a=(n(7294),n(3905));const i={id:"IndexParamsUsingGSIExceptions",title:"Class: IndexParamsUsingGSIExceptions",sidebar_label:"IndexParamsUsingGSIExceptions",sidebar_position:0,custom_edit_url:null},s=void 0,o={unversionedId:"api/classes/IndexParamsUsingGSIExceptions",id:"api/classes/IndexParamsUsingGSIExceptions",title:"Class: IndexParamsUsingGSIExceptions",description:"Hierarchy",source:"@site/docs/api/classes/IndexParamsUsingGSIExceptions.md",sourceDirName:"api/classes",slug:"/api/classes/IndexParamsUsingGSIExceptions",permalink:"/docs/api/classes/IndexParamsUsingGSIExceptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IndexParamsUsingGSIExceptions",title:"Class: IndexParamsUsingGSIExceptions",sidebar_label:"IndexParamsUsingGSIExceptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IndexParamsOnExceptions",permalink:"/docs/api/classes/IndexParamsOnExceptions"},next:{title:"ManyQueryResponse",permalink:"/docs/api/classes/ManyQueryResponse"}},l={},c=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"IndexParamsUsingGSIExceptions"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new IndexParamsUsingGSIExceptions"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"clause"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"clause")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/exceptions.ts#L51"},"query/exceptions.ts:51")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[3910],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=r.createContext({}),c=function(e){var t=r.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):s(s({},t),e)),n},p=function(e){var t=c(e.components);return r.createElement(l.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=o(e,["components","mdxType","originalType","parentName"]),u=c(n),m=a,f=u["".concat(l,".").concat(m)]||u[m]||d[m]||i;return n?r.createElement(f,s(s({ref:t},p),{},{components:n})):r.createElement(f,s({ref:t},p))}));function m(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,s=new Array(i);s[0]=u;var o={};for(var l in t)hasOwnProperty.call(t,l)&&(o[l]=t[l]);o.originalType=e,o.mdxType="string"==typeof e?e:a,s[1]=o;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>s,default:()=>d,frontMatter:()=>i,metadata:()=>o,toc:()=>c});var r=n(7462),a=(n(7294),n(3905));const i={id:"IndexParamsUsingGSIExceptions",title:"Class: IndexParamsUsingGSIExceptions",sidebar_label:"IndexParamsUsingGSIExceptions",sidebar_position:0,custom_edit_url:null},s=void 0,o={unversionedId:"api/classes/IndexParamsUsingGSIExceptions",id:"api/classes/IndexParamsUsingGSIExceptions",title:"Class: IndexParamsUsingGSIExceptions",description:"Hierarchy",source:"@site/docs/api/classes/IndexParamsUsingGSIExceptions.md",sourceDirName:"api/classes",slug:"/api/classes/IndexParamsUsingGSIExceptions",permalink:"/docs/api/classes/IndexParamsUsingGSIExceptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IndexParamsUsingGSIExceptions",title:"Class: IndexParamsUsingGSIExceptions",sidebar_label:"IndexParamsUsingGSIExceptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IndexParamsOnExceptions",permalink:"/docs/api/classes/IndexParamsOnExceptions"},next:{title:"ManyQueryResponse",permalink:"/docs/api/classes/ManyQueryResponse"}},l={},c=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:c};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"IndexParamsUsingGSIExceptions"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new IndexParamsUsingGSIExceptions"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"clause"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"clause")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,a.kt)("h4",{id:"overrides"},"Overrides"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/exceptions.ts#L51"},"query/exceptions.ts:51")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/9ec0e5bc.af47a24a.js b/assets/js/9ec0e5bc.6715db71.js similarity index 95% rename from assets/js/9ec0e5bc.af47a24a.js rename to assets/js/9ec0e5bc.6715db71.js index 9314215a..d2239903 100644 --- a/assets/js/9ec0e5bc.af47a24a.js +++ b/assets/js/9ec0e5bc.6715db71.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9547],{3905:(e,t,n)=>{n.d(t,{Zo:()=>o,kt:()=>u});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),s=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},o=function(e){var t=s(e.components);return a.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),k=s(n),u=r,c=k["".concat(d,".").concat(u)]||k[u]||m[u]||i;return n?a.createElement(c,l(l({ref:t},o),{},{components:n})):a.createElement(c,l({ref:t},o))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>s});var a=n(7462),r=(n(7294),n(3905));const i={id:"StringType",title:"Class: StringType",sidebar_label:"StringType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/StringType",id:"api/classes/StringType",title:"Class: StringType",description:"String are plain JavaScript String and accepts the following options:",source:"@site/docs/api/classes/StringType.md",sourceDirName:"api/classes",slug:"/api/classes/StringType",permalink:"/docs/api/classes/StringType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"StringType",title:"Class: StringType",sidebar_label:"StringType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"SelectClauseException",permalink:"/docs/api/classes/SelectClauseException"},next:{title:"ValidationError",permalink:"/docs/api/classes/ValidationError"}},d={},s=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"auto",id:"auto",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"default",id:"default",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"enumValues",id:"enumvalues",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"lowercase",id:"lowercase",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"maxLength",id:"maxlength",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"minLength",id:"minlength",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"trim",id:"trim",level:3},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"uppercase",id:"uppercase",level:3},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-9",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"Methods",id:"methods",level:2},{value:"_checkEnum",id:"_checkenum",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"_checkIntegrity",id:"_checkintegrity",level:3},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"_checkMaxLength",id:"_checkmaxlength",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"_checkMinLength",id:"_checkminlength",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-14",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-19",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-15",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-16",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Overrides",id:"overrides-4",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-19",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-24",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Overrides",id:"overrides-5",level:4},{value:"Defined in",id:"defined-in-25",level:4}],o={toc:s};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"String")," are plain JavaScript String and accepts the following options:"),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field, allowed function, object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, allowed and value or function to generate it"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"enum")," defines a list of allowed values"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"auto")," that will generate the initial value of the field. It allows the value 'uuid' or a function. It cannot be used combined with default")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const userSchema = new Schema({\n name: { type: String, auto: 'uuid', trim: true },\n gender: { type: String, enum: ['M', 'F'] }\n lastname: Schema.Types.String,\n user: { type: String, lowercase: true, minLength: 4, maxLength: 7 }\n})\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"StringType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new StringType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"StringTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L179"},"schema/types/string-type.ts:179")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"StringTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L179"},"schema/types/string-type.ts:179")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"String.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L184"},"schema/types/string-type.ts:184")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"auto"},"auto"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"auto"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"AutoFunction")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"AutoFunction")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L190"},"schema/types/string-type.ts:190")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"enumvalues"},"enumValues"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"enumValues"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L186"},"schema/types/string-type.ts:186")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"lowercase"},"lowercase"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"lowercase"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L194"},"schema/types/string-type.ts:194")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxlength"},"maxLength"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"maxLength"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L208"},"schema/types/string-type.ts:208")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minlength"},"minLength"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"minLength"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L205"},"schema/types/string-type.ts:205")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"trim"},"trim"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"trim"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L202"},"schema/types/string-type.ts:202")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"uppercase"},"uppercase"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"uppercase"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L198"},"schema/types/string-type.ts:198")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_checkenum"},"_","checkEnum"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkEnum"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"errors"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"errors")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L261"},"schema/types/string-type.ts:261")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkintegrity"},"_","checkIntegrity"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkIntegrity"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L284"},"schema/types/string-type.ts:284")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkmaxlength"},"_","checkMaxLength"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMaxLength"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"errors"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"errors")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L277"},"schema/types/string-type.ts:277")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkminlength"},"_","checkMinLength"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMinLength"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"errors"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"errors")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L270"},"schema/types/string-type.ts:270")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L212"},"schema/types/string-type.ts:212")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L220"},"schema/types/string-type.ts:220")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"overrides-4"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L302"},"schema/types/string-type.ts:302")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"null")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"null")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"overrides-5"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-25"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/string-type.ts#L240"},"schema/types/string-type.ts:240")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9547],{3905:(e,t,n)=>{n.d(t,{Zo:()=>o,kt:()=>u});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),s=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},o=function(e){var t=s(e.components);return a.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),k=s(n),u=r,c=k["".concat(d,".").concat(u)]||k[u]||m[u]||i;return n?a.createElement(c,l(l({ref:t},o),{},{components:n})):a.createElement(c,l({ref:t},o))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>s});var a=n(7462),r=(n(7294),n(3905));const i={id:"StringType",title:"Class: StringType",sidebar_label:"StringType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/StringType",id:"api/classes/StringType",title:"Class: StringType",description:"String are plain JavaScript String and accepts the following options:",source:"@site/docs/api/classes/StringType.md",sourceDirName:"api/classes",slug:"/api/classes/StringType",permalink:"/docs/api/classes/StringType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"StringType",title:"Class: StringType",sidebar_label:"StringType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"SelectClauseException",permalink:"/docs/api/classes/SelectClauseException"},next:{title:"ValidationError",permalink:"/docs/api/classes/ValidationError"}},d={},s=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"auto",id:"auto",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"default",id:"default",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"enumValues",id:"enumvalues",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"lowercase",id:"lowercase",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"maxLength",id:"maxlength",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"minLength",id:"minlength",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"trim",id:"trim",level:3},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"uppercase",id:"uppercase",level:3},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-9",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"Methods",id:"methods",level:2},{value:"_checkEnum",id:"_checkenum",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"_checkIntegrity",id:"_checkintegrity",level:3},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"_checkMaxLength",id:"_checkmaxlength",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"_checkMinLength",id:"_checkminlength",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-14",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-19",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-15",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-16",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Overrides",id:"overrides-4",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-19",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-24",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Overrides",id:"overrides-5",level:4},{value:"Defined in",id:"defined-in-25",level:4}],o={toc:s};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"String")," are plain JavaScript String and accepts the following options:"),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field, allowed function, object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, allowed and value or function to generate it"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"enum")," defines a list of allowed values"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"auto")," that will generate the initial value of the field. It allows the value 'uuid' or a function. It cannot be used combined with default")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const userSchema = new Schema({\n name: { type: String, auto: 'uuid', trim: true },\n gender: { type: String, enum: ['M', 'F'] }\n lastname: Schema.Types.String,\n user: { type: String, lowercase: true, minLength: 4, maxLength: 7 }\n})\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"StringType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new StringType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"StringTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L179"},"schema/types/string-type.ts:179")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"StringTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L179"},"schema/types/string-type.ts:179")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"String.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L184"},"schema/types/string-type.ts:184")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"auto"},"auto"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"auto"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"AutoFunction")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"AutoFunction")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L190"},"schema/types/string-type.ts:190")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"enumvalues"},"enumValues"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"enumValues"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L186"},"schema/types/string-type.ts:186")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"lowercase"},"lowercase"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"lowercase"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L194"},"schema/types/string-type.ts:194")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxlength"},"maxLength"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"maxLength"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L208"},"schema/types/string-type.ts:208")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"minlength"},"minLength"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"minLength"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L205"},"schema/types/string-type.ts:205")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"trim"},"trim"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"trim"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L202"},"schema/types/string-type.ts:202")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"uppercase"},"uppercase"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"uppercase"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L198"},"schema/types/string-type.ts:198")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_checkenum"},"_","checkEnum"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkEnum"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"errors"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"errors")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L261"},"schema/types/string-type.ts:261")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkintegrity"},"_","checkIntegrity"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkIntegrity"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L284"},"schema/types/string-type.ts:284")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkmaxlength"},"_","checkMaxLength"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMaxLength"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"errors"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"errors")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L277"},"schema/types/string-type.ts:277")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkminlength"},"_","checkMinLength"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMinLength"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"errors"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"errors")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L270"},"schema/types/string-type.ts:270")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L212"},"schema/types/string-type.ts:212")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L220"},"schema/types/string-type.ts:220")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"overrides-4"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L302"},"schema/types/string-type.ts:302")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"null")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"null")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"overrides-5"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-25"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/string-type.ts#L240"},"schema/types/string-type.ts:240")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/aeea3ecd.71910efb.js b/assets/js/aeea3ecd.71910efb.js deleted file mode 100644 index 96255bb6..00000000 --- a/assets/js/aeea3ecd.71910efb.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7157],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>p});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},h={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(n),p=r,m=d["".concat(l,".").concat(p)]||d[p]||h[p]||o;return n?a.createElement(m,i(i({ref:t},u),{},{components:n})):a.createElement(m,i({ref:t},u))}));function p(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=n(7462),r=(n(7294),n(3905));const o={sidebar_position:0,title:"Full Text Search"},i=void 0,s={unversionedId:"advanced/fts",id:"advanced/fts",title:"Full Text Search",description:"You can use the Full Text Search service (FTS) to create queryable full-text indexes in Couchbase Server.",source:"@site/docs/advanced/fts.md",sourceDirName:"advanced",slug:"/advanced/fts",permalink:"/docs/advanced/fts",draft:!1,tags:[],version:"current",sidebarPosition:0,frontMatter:{sidebar_position:0,title:"Full Text Search"},sidebar:"tutorialSidebar",previous:{title:"Query Builder",permalink:"/docs/basic/query-builder"},next:{title:"How Ottoman Works",permalink:"/docs/advanced/how-ottoman-works"}},l={},c=[{value:"Examples",id:"examples",level:2},{value:"Match",id:"match",level:4},{value:"Match Phrase",id:"match-phrase",level:4},{value:"Date Range",id:"date-range",level:4},{value:"Conjunction",id:"conjunction",level:4},{value:"Disjunction",id:"disjunction",level:4},{value:"Working with Results",id:"working-with-results",level:2},{value:"Iterating over Hits",id:"iterating-over-hits",level:4},{value:"Facets",id:"facets",level:4},{value:"Scan Consistency and ConsistentWith",id:"scan-consistency-and-consistentwith",level:2},{value:"Scan consistency example:",id:"scan-consistency-example",level:4}],u={toc:c};function h(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"You can use the Full Text Search service (FTS) to create queryable full-text indexes in Couchbase Server.\nFTS allows you to create, manage, and query full-text indexes on JSON documents stored in Couchbase buckets."),(0,r.kt)("p",null,"It uses natural language processing for querying documents, provides relevance scoring on the results of your queries, and has fast indexes for querying a wide range of possible text searches."),(0,r.kt)("p",null,"Supported query types include simple queries like Match and Term queries; range queries like Date Range and Numeric Range; and compound queries for conjunctions, disjunctions, and/or boolean queries."),(0,r.kt)("p",null,"Ottoman exposes an API for performing FTS queries which abstracts some of the complexity of using the Node.js SDK."),(0,r.kt)("h2",{id:"examples"},"Examples"),(0,r.kt)("p",null,"Search queries are executed at the cluster level (not bucket or collection). All examples below will console log our returned documents along with their metadata and rows, each returned document has an index, id, score and sort value."),(0,r.kt)("h4",{id:"match"},"Match"),(0,r.kt)("p",null,"Using the ",(0,r.kt)("inlineCode",{parentName:"p"},"travel-sample")," ",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/7.1/manage/manage-settings/install-sample-buckets.html"},"Sample Bucket"),", we define an FTS SearchQuery using the ",(0,r.kt)("inlineCode",{parentName:"p"},"match()"),' method to search for the specified term: "five-star".'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery } from 'ottoman';\n\nasync function ftsMatchWord(term) {\n return await searchQuery('index-hotel-description', SearchQuery.match(term), { limit: 5 });\n}\n\nvar result = await ftsMatchWord('five-star');\nconsole.log('RESULT:', result);\n")),(0,r.kt)("h4",{id:"match-phrase"},"Match Phrase"),(0,r.kt)("p",null,"An FTS SearchQuery using the ",(0,r.kt)("inlineCode",{parentName:"p"},"matchPhrase()")," method to find a specified phrase: ",(0,r.kt)("inlineCode",{parentName:"p"},'"10-minute walk from the"'),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery } from 'ottoman';\n\nasync function ftsMatchPhrase(phrase) {\n return await searchQuery('index-hotel-description', SearchQuery.matchPhrase(phrase), { limit: 10 });\n}\n\nresult = await ftsMatchPhrase('10-minute walk from the');\nconsole.log('RESULT:', result);\n")),(0,r.kt)("p",null,"When searching for a phrase we get some additional benefits outside of the ",(0,r.kt)("inlineCode",{parentName:"p"},"match()")," method. The match phrase query for ",(0,r.kt)("inlineCode",{parentName:"p"},'"10-minute walk from the"')," will produce the following hits from our travel-sample dataset:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'hits:\n hotel_11331: "10-minute walk from village"\n hotel_15915: "10 minute walk from Echo Arena"\n hotel_3606: "10 minute walk to the centre"\n hotel_28259: "10 minute walk to the coastal path"\n')),(0,r.kt)("p",null,"If you run this code, notice that we matched ",(0,r.kt)("inlineCode",{parentName:"p"},'"10-minute"')," with three additional hits on ",(0,r.kt)("inlineCode",{parentName:"p"},'"10 minute"')," (without the dash).\nSo, we get some of the same matches on variations of that term just as we would with a regular ",(0,r.kt)("inlineCode",{parentName:"p"},"match()")," method search,\nhowever; notice that ",(0,r.kt)("inlineCode",{parentName:"p"},'"walk from the"')," hits on several variations of this phrase:\n",(0,r.kt)("inlineCode",{parentName:"p"},'"walk from"')," (where ",(0,r.kt)("inlineCode",{parentName:"p"},'"the"')," was removed) and ",(0,r.kt)("inlineCode",{parentName:"p"},'"walk to the"')," (where ",(0,r.kt)("inlineCode",{parentName:"p"},'"from"')," was removed).\nThis is specific to searching phrases and helps provide us with various matches relevant to our search."),(0,r.kt)("h4",{id:"date-range"},"Date Range"),(0,r.kt)("p",null,"Here we define an FTS SearchQuery that uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"dateRange()")," method to search for hotels where the updated field (",(0,r.kt)("inlineCode",{parentName:"p"},"datetime"),") falls within a specified date range."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery, Schema, model } from 'ottoman';\n\nasync function ftsHotelByDateRange(startDate, endDate) {\n const schema = new Schema({\n name: String,\n updated: Date,\n description: String\n });\n \n const Hotel = model('hotel', schema, {modelKey: 'type', keyGeneratorDelimiter: '_'});\n \n await Hotel.updateById('hotel_fts_123', {\n name: 'HotelFTS',\n updated: new Date('2010-11-10 18:33:50 +0300'),\n description: 'a fancy hotel',\n })\n\n return searchQuery(\n 'index-hotel-description',\n SearchQuery.dateRange().start(startDate).end(endDate),\n {\n limit: 5,\n }\n )\n}\n\nresult = await ftsHotelByDateRange('2010-11-10', '2010-11-20')\nconsole.log('RESULT:', result)\n")),(0,r.kt)("h4",{id:"conjunction"},"Conjunction"),(0,r.kt)("p",null,"A query satisfying multiple child queries. The example below will only return two documents hitting on the term ",(0,r.kt)("inlineCode",{parentName:"p"},'"five-star"'),"\nand the phrase ",(0,r.kt)("inlineCode",{parentName:"p"},'"luxury hotel"')," while no other documents match both criteria."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery } from 'ottoman';\n\nasync function ftsConjunction() {\n return await searchQuery(\n 'index-hotel-description',\n SearchQuery.conjuncts(\n SearchQuery.match('five-star'),\n SearchQuery.matchPhrase('luxury hotel')\n )\n )\n}\n\nvar result = await ftsConjunction()\nconsole.log('RESULT:', result)\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Our match for ",(0,r.kt)("inlineCode",{parentName:"p"},'"five-star"')," was not exact, but still produced a result because a similar term was found ",(0,r.kt)("inlineCode",{parentName:"p"},'"Five star"'),",\nwe could have potentially matched ",(0,r.kt)("inlineCode",{parentName:"p"},'"5 star"')," or the word ",(0,r.kt)("inlineCode",{parentName:"p"},'"five"'),".\nWhen you work with any full-text search the number of hits you get and their score are variable.")),(0,r.kt)("h4",{id:"disjunction"},"Disjunction"),(0,r.kt)("p",null,"A query satisfying (by default) one query or another.\nIf a conjunction query can be thought of like using an ",(0,r.kt)("inlineCode",{parentName:"p"},"AND")," operator, a disjunction would be like using an ",(0,r.kt)("inlineCode",{parentName:"p"},"OR")," operator.\nThe example below will return seven documents hitting on the term ",(0,r.kt)("inlineCode",{parentName:"p"},'"Louvre"')," and five hits on the term ",(0,r.kt)("inlineCode",{parentName:"p"},'"Eiffel"')," returning a total of 12 rows together as part of a disjunction query."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery, TermSearchFacet } from 'ottoman';\n\nasync function ftsDisjunction() {\n return await searchQuery(\n 'index-hotel-description',\n SearchQuery.disjuncts(\n SearchQuery.match('Louvre'),\n SearchQuery.match('Eiffel')\n ),\n {\n facets: {\n Descriptions: new TermSearchFacet('description', 5),\n },\n limit: 12,\n }\n )\n}\n\nresult = await ftsDisjunction()\nconsole.log('RESULT:', result)\n")),(0,r.kt)("h2",{id:"working-with-results"},"Working with Results"),(0,r.kt)("p",null,"As with all query result types in Ottoman, the search query results object contains two properties. The hits reflecting the documents that matched your query, emitted as rows. Along with the metadata available in the meta property."),(0,r.kt)("p",null,"Metadata holds additional information not directly related to your query, such as success total hits and how long the query took to execute in the cluster."),(0,r.kt)("h4",{id:"iterating-over-hits"},"Iterating over Hits"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"result.rows.forEach((hit, index) => {\n const docId = hit.id\n const score = hit.score\n const resultNum = index + 1\n console.log(`Result #${resultNum} ID: ${docId} Score: ${score}`)\n})\n")),(0,r.kt)("h4",{id:"facets"},"Facets"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"var facets = result.meta.facets\nconsole.log('Descriptions facet:', facets.Descriptions)\n")),(0,r.kt)("h2",{id:"scan-consistency-and-consistentwith"},"Scan Consistency and ConsistentWith"),(0,r.kt)("p",null,"By default, all Search queries will return the data from whatever is in the index at the time of query.\nThese semantics can be tuned if needed so that the hits returned include the most recently performed mutations,\nat the cost of slightly higher latency since the index needs to be updated first."),(0,r.kt)("p",null,"There are two ways to control consistency: either by supplying a custom ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchScanConsistency")," or using ",(0,r.kt)("inlineCode",{parentName:"p"},"consistentWith"),".\nAt the moment the cluster only supports ",(0,r.kt)("inlineCode",{parentName:"p"},"consistentWith"),", which is why you only see ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchScanConsistency.NotBounded"),'\nin the enum which is the default setting.\nThe way to make sure that recently written documents show up in the search works as follows (commonly referred to "',(0,r.kt)("inlineCode",{parentName:"p"},'read your own writes"'),"\u2009\u2014\u2009RYOW):"),(0,r.kt)("h4",{id:"scan-consistency-example"},"Scan consistency example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery, SearchScanConsistency } from 'ottoman';\n\nresult = await searchQuery(\n 'index-hotel-description',\n SearchQuery.match('swanky'),\n { consistency: SearchScanConsistency.NotBounded }\n) \n")))}h.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/aeea3ecd.88047474.js b/assets/js/aeea3ecd.88047474.js new file mode 100644 index 00000000..9972ce6f --- /dev/null +++ b/assets/js/aeea3ecd.88047474.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7157],{3905:(e,t,n)=>{n.d(t,{Zo:()=>u,kt:()=>p});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},h={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,o=e.originalType,l=e.parentName,u=s(e,["components","mdxType","originalType","parentName"]),d=c(n),p=r,m=d["".concat(l,".").concat(p)]||d[p]||h[p]||o;return n?a.createElement(m,i(i({ref:t},u),{},{components:n})):a.createElement(m,i({ref:t},u))}));function p(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var o=n.length,i=new Array(o);i[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:r,i[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>i,default:()=>h,frontMatter:()=>o,metadata:()=>s,toc:()=>c});var a=n(7462),r=(n(7294),n(3905));const o={sidebar_position:0,title:"Full Text Search"},i=void 0,s={unversionedId:"advanced/fts",id:"advanced/fts",title:"Full Text Search",description:"You can use the Full Text Search service (FTS) to create queryable full-text indexes in Couchbase Server.",source:"@site/docs/advanced/fts.md",sourceDirName:"advanced",slug:"/advanced/fts",permalink:"/docs/advanced/fts",draft:!1,tags:[],version:"current",sidebarPosition:0,frontMatter:{sidebar_position:0,title:"Full Text Search"},sidebar:"tutorialSidebar",previous:{title:"Query Builder",permalink:"/docs/basic/query-builder"},next:{title:"Transactions",permalink:"/docs/advanced/transactions"}},l={},c=[{value:"Examples",id:"examples",level:2},{value:"Match",id:"match",level:4},{value:"Match Phrase",id:"match-phrase",level:4},{value:"Date Range",id:"date-range",level:4},{value:"Conjunction",id:"conjunction",level:4},{value:"Disjunction",id:"disjunction",level:4},{value:"Working with Results",id:"working-with-results",level:2},{value:"Iterating over Hits",id:"iterating-over-hits",level:4},{value:"Facets",id:"facets",level:4},{value:"Scan Consistency and ConsistentWith",id:"scan-consistency-and-consistentwith",level:2},{value:"Scan consistency example:",id:"scan-consistency-example",level:4}],u={toc:c};function h(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},u,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"You can use the Full Text Search service (FTS) to create queryable full-text indexes in Couchbase Server.\nFTS allows you to create, manage, and query full-text indexes on JSON documents stored in Couchbase buckets."),(0,r.kt)("p",null,"It uses natural language processing for querying documents, provides relevance scoring on the results of your queries, and has fast indexes for querying a wide range of possible text searches."),(0,r.kt)("p",null,"Supported query types include simple queries like Match and Term queries; range queries like Date Range and Numeric Range; and compound queries for conjunctions, disjunctions, and/or boolean queries."),(0,r.kt)("p",null,"Ottoman exposes an API for performing FTS queries which abstracts some of the complexity of using the Node.js SDK."),(0,r.kt)("h2",{id:"examples"},"Examples"),(0,r.kt)("p",null,"Search queries are executed at the cluster level (not bucket or collection). All examples below will console log our returned documents along with their metadata and rows, each returned document has an index, id, score and sort value."),(0,r.kt)("h4",{id:"match"},"Match"),(0,r.kt)("p",null,"Using the ",(0,r.kt)("inlineCode",{parentName:"p"},"travel-sample")," ",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/7.1/manage/manage-settings/install-sample-buckets.html"},"Sample Bucket"),", we define an FTS SearchQuery using the ",(0,r.kt)("inlineCode",{parentName:"p"},"match()"),' method to search for the specified term: "five-star".'),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery } from 'ottoman';\n\nasync function ftsMatchWord(term) {\n return await searchQuery('index-hotel-description', SearchQuery.match(term), { limit: 5 });\n}\n\nvar result = await ftsMatchWord('five-star');\nconsole.log('RESULT:', result);\n")),(0,r.kt)("h4",{id:"match-phrase"},"Match Phrase"),(0,r.kt)("p",null,"An FTS SearchQuery using the ",(0,r.kt)("inlineCode",{parentName:"p"},"matchPhrase()")," method to find a specified phrase: ",(0,r.kt)("inlineCode",{parentName:"p"},'"10-minute walk from the"'),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery } from 'ottoman';\n\nasync function ftsMatchPhrase(phrase) {\n return await searchQuery('index-hotel-description', SearchQuery.matchPhrase(phrase), { limit: 10 });\n}\n\nresult = await ftsMatchPhrase('10-minute walk from the');\nconsole.log('RESULT:', result);\n")),(0,r.kt)("p",null,"When searching for a phrase we get some additional benefits outside of the ",(0,r.kt)("inlineCode",{parentName:"p"},"match()")," method. The match phrase query for ",(0,r.kt)("inlineCode",{parentName:"p"},'"10-minute walk from the"')," will produce the following hits from our travel-sample dataset:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-shell"},'hits:\n hotel_11331: "10-minute walk from village"\n hotel_15915: "10 minute walk from Echo Arena"\n hotel_3606: "10 minute walk to the centre"\n hotel_28259: "10 minute walk to the coastal path"\n')),(0,r.kt)("p",null,"If you run this code, notice that we matched ",(0,r.kt)("inlineCode",{parentName:"p"},'"10-minute"')," with three additional hits on ",(0,r.kt)("inlineCode",{parentName:"p"},'"10 minute"')," (without the dash).\nSo, we get some of the same matches on variations of that term just as we would with a regular ",(0,r.kt)("inlineCode",{parentName:"p"},"match()")," method search,\nhowever; notice that ",(0,r.kt)("inlineCode",{parentName:"p"},'"walk from the"')," hits on several variations of this phrase:\n",(0,r.kt)("inlineCode",{parentName:"p"},'"walk from"')," (where ",(0,r.kt)("inlineCode",{parentName:"p"},'"the"')," was removed) and ",(0,r.kt)("inlineCode",{parentName:"p"},'"walk to the"')," (where ",(0,r.kt)("inlineCode",{parentName:"p"},'"from"')," was removed).\nThis is specific to searching phrases and helps provide us with various matches relevant to our search."),(0,r.kt)("h4",{id:"date-range"},"Date Range"),(0,r.kt)("p",null,"Here we define an FTS SearchQuery that uses the ",(0,r.kt)("inlineCode",{parentName:"p"},"dateRange()")," method to search for hotels where the updated field (",(0,r.kt)("inlineCode",{parentName:"p"},"datetime"),") falls within a specified date range."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery, Schema, model } from 'ottoman';\n\nasync function ftsHotelByDateRange(startDate, endDate) {\n const schema = new Schema({\n name: String,\n updated: Date,\n description: String\n });\n \n const Hotel = model('hotel', schema, {modelKey: 'type', keyGeneratorDelimiter: '_'});\n \n await Hotel.updateById('hotel_fts_123', {\n name: 'HotelFTS',\n updated: new Date('2010-11-10 18:33:50 +0300'),\n description: 'a fancy hotel',\n })\n\n return searchQuery(\n 'index-hotel-description',\n SearchQuery.dateRange().start(startDate).end(endDate),\n {\n limit: 5,\n }\n )\n}\n\nresult = await ftsHotelByDateRange('2010-11-10', '2010-11-20')\nconsole.log('RESULT:', result)\n")),(0,r.kt)("h4",{id:"conjunction"},"Conjunction"),(0,r.kt)("p",null,"A query satisfying multiple child queries. The example below will only return two documents hitting on the term ",(0,r.kt)("inlineCode",{parentName:"p"},'"five-star"'),"\nand the phrase ",(0,r.kt)("inlineCode",{parentName:"p"},'"luxury hotel"')," while no other documents match both criteria."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery } from 'ottoman';\n\nasync function ftsConjunction() {\n return await searchQuery(\n 'index-hotel-description',\n SearchQuery.conjuncts(\n SearchQuery.match('five-star'),\n SearchQuery.matchPhrase('luxury hotel')\n )\n )\n}\n\nvar result = await ftsConjunction()\nconsole.log('RESULT:', result)\n")),(0,r.kt)("admonition",{type:"info"},(0,r.kt)("p",{parentName:"admonition"},"Our match for ",(0,r.kt)("inlineCode",{parentName:"p"},'"five-star"')," was not exact, but still produced a result because a similar term was found ",(0,r.kt)("inlineCode",{parentName:"p"},'"Five star"'),",\nwe could have potentially matched ",(0,r.kt)("inlineCode",{parentName:"p"},'"5 star"')," or the word ",(0,r.kt)("inlineCode",{parentName:"p"},'"five"'),".\nWhen you work with any full-text search the number of hits you get and their score are variable.")),(0,r.kt)("h4",{id:"disjunction"},"Disjunction"),(0,r.kt)("p",null,"A query satisfying (by default) one query or another.\nIf a conjunction query can be thought of like using an ",(0,r.kt)("inlineCode",{parentName:"p"},"AND")," operator, a disjunction would be like using an ",(0,r.kt)("inlineCode",{parentName:"p"},"OR")," operator.\nThe example below will return seven documents hitting on the term ",(0,r.kt)("inlineCode",{parentName:"p"},'"Louvre"')," and five hits on the term ",(0,r.kt)("inlineCode",{parentName:"p"},'"Eiffel"')," returning a total of 12 rows together as part of a disjunction query."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery, TermSearchFacet } from 'ottoman';\n\nasync function ftsDisjunction() {\n return await searchQuery(\n 'index-hotel-description',\n SearchQuery.disjuncts(\n SearchQuery.match('Louvre'),\n SearchQuery.match('Eiffel')\n ),\n {\n facets: {\n Descriptions: new TermSearchFacet('description', 5),\n },\n limit: 12,\n }\n )\n}\n\nresult = await ftsDisjunction()\nconsole.log('RESULT:', result)\n")),(0,r.kt)("h2",{id:"working-with-results"},"Working with Results"),(0,r.kt)("p",null,"As with all query result types in Ottoman, the search query results object contains two properties. The hits reflecting the documents that matched your query, emitted as rows. Along with the metadata available in the meta property."),(0,r.kt)("p",null,"Metadata holds additional information not directly related to your query, such as success total hits and how long the query took to execute in the cluster."),(0,r.kt)("h4",{id:"iterating-over-hits"},"Iterating over Hits"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"result.rows.forEach((hit, index) => {\n const docId = hit.id\n const score = hit.score\n const resultNum = index + 1\n console.log(`Result #${resultNum} ID: ${docId} Score: ${score}`)\n})\n")),(0,r.kt)("h4",{id:"facets"},"Facets"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"var facets = result.meta.facets\nconsole.log('Descriptions facet:', facets.Descriptions)\n")),(0,r.kt)("h2",{id:"scan-consistency-and-consistentwith"},"Scan Consistency and ConsistentWith"),(0,r.kt)("p",null,"By default, all Search queries will return the data from whatever is in the index at the time of query.\nThese semantics can be tuned if needed so that the hits returned include the most recently performed mutations,\nat the cost of slightly higher latency since the index needs to be updated first."),(0,r.kt)("p",null,"There are two ways to control consistency: either by supplying a custom ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchScanConsistency")," or using ",(0,r.kt)("inlineCode",{parentName:"p"},"consistentWith"),".\nAt the moment the cluster only supports ",(0,r.kt)("inlineCode",{parentName:"p"},"consistentWith"),", which is why you only see ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchScanConsistency.NotBounded"),'\nin the enum which is the default setting.\nThe way to make sure that recently written documents show up in the search works as follows (commonly referred to "',(0,r.kt)("inlineCode",{parentName:"p"},'read your own writes"'),"\u2009\u2014\u2009RYOW):"),(0,r.kt)("h4",{id:"scan-consistency-example"},"Scan consistency example:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"import { searchQuery, SearchQuery, SearchScanConsistency } from 'ottoman';\n\nresult = await searchQuery(\n 'index-hotel-description',\n SearchQuery.match('swanky'),\n { consistency: SearchScanConsistency.NotBounded }\n) \n")))}h.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/b87196ac.1169ac2e.js b/assets/js/b87196ac.ecf9b58d.js similarity index 98% rename from assets/js/b87196ac.1169ac2e.js rename to assets/js/b87196ac.ecf9b58d.js index ad9b9c73..09dbf51b 100644 --- a/assets/js/b87196ac.1169ac2e.js +++ b/assets/js/b87196ac.ecf9b58d.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5474],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(7462),a=(r(7294),r(3905));const o={id:"ValidationError",title:"Class: ValidationError",sidebar_label:"ValidationError",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/ValidationError",id:"api/classes/ValidationError",title:"Class: ValidationError",description:"Hierarchy",source:"@site/docs/api/classes/ValidationError.md",sourceDirName:"api/classes",slug:"/api/classes/ValidationError",permalink:"/docs/api/classes/ValidationError",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ValidationError",title:"Class: ValidationError",sidebar_label:"ValidationError",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"StringType",permalink:"/docs/api/classes/StringType"},next:{title:"ViewIndexOptions",permalink:"/docs/api/classes/ViewIndexOptions"}},s={},c=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"ValidationError"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new ValidationError"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"message?"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"message?")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"))))),(0,a.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/exceptions/ottoman-errors.ts#L2"},"exceptions/ottoman-errors.ts:2")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[5474],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function o(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,o=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(r),m=a,f=u["".concat(s,".").concat(m)]||u[m]||d[m]||o;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var o=r.length,i=new Array(o);i[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,i[1]=l;for(var c=2;c{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>i,default:()=>d,frontMatter:()=>o,metadata:()=>l,toc:()=>c});var n=r(7462),a=(r(7294),r(3905));const o={id:"ValidationError",title:"Class: ValidationError",sidebar_label:"ValidationError",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/ValidationError",id:"api/classes/ValidationError",title:"Class: ValidationError",description:"Hierarchy",source:"@site/docs/api/classes/ValidationError.md",sourceDirName:"api/classes",slug:"/api/classes/ValidationError",permalink:"/docs/api/classes/ValidationError",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ValidationError",title:"Class: ValidationError",sidebar_label:"ValidationError",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"StringType",permalink:"/docs/api/classes/StringType"},next:{title:"ViewIndexOptions",permalink:"/docs/api/classes/ViewIndexOptions"}},s={},c=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:c};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("p",{parentName:"li"},(0,a.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,a.kt)("p",{parentName:"li"},"\u21b3 ",(0,a.kt)("strong",{parentName:"p"},(0,a.kt)("inlineCode",{parentName:"strong"},"ValidationError"))))),(0,a.kt)("h2",{id:"constructors"},"Constructors"),(0,a.kt)("h3",{id:"constructor"},"constructor"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"new ValidationError"),"(",(0,a.kt)("inlineCode",{parentName:"p"},"message?"),")"),(0,a.kt)("h4",{id:"parameters"},"Parameters"),(0,a.kt)("table",null,(0,a.kt)("thead",{parentName:"table"},(0,a.kt)("tr",{parentName:"thead"},(0,a.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,a.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,a.kt)("tbody",{parentName:"table"},(0,a.kt)("tr",{parentName:"tbody"},(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"message?")),(0,a.kt)("td",{parentName:"tr",align:"left"},(0,a.kt)("inlineCode",{parentName:"td"},"string"))))),(0,a.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,a.kt)("p",null,"OttomanError.constructor"),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/exceptions/ottoman-errors.ts#L2"},"exceptions/ottoman-errors.ts:2")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ba211ef4.e8f8efe1.js b/assets/js/ba211ef4.5ddc32cc.js similarity index 97% rename from assets/js/ba211ef4.e8f8efe1.js rename to assets/js/ba211ef4.5ddc32cc.js index 9e9eca9c..42eea710 100644 --- a/assets/js/ba211ef4.e8f8efe1.js +++ b/assets/js/ba211ef4.5ddc32cc.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6635],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>c});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),o=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=o(e.components);return a.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=o(n),c=r,y=u["".concat(p,".").concat(c)]||u[c]||m[c]||s;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var o=2;o{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>o});var a=n(7462),r=(n(7294),n(3905));const s={id:"ManyQueryResponse",title:"Class: ManyQueryResponse",sidebar_label:"ManyQueryResponse",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/ManyQueryResponse",id:"api/classes/ManyQueryResponse",title:"Class: ManyQueryResponse",description:"Response class for bulk operations.",source:"@site/docs/api/classes/ManyQueryResponse.md",sourceDirName:"api/classes",slug:"/api/classes/ManyQueryResponse",permalink:"/docs/api/classes/ManyQueryResponse",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ManyQueryResponse",title:"Class: ManyQueryResponse",sidebar_label:"ManyQueryResponse",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IndexParamsUsingGSIExceptions",permalink:"/docs/api/classes/IndexParamsUsingGSIExceptions"},next:{title:"MixedType",permalink:"/docs/api/classes/MixedType"}},p={},o=[{value:"Type parameters",id:"type-parameters",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Implements",id:"implements",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"Implementation of",id:"implementation-of",level:4},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"status",id:"status",level:3},{value:"Implementation of",id:"implementation-of-1",level:4},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4}],d={toc:o};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Response class for bulk operations."),(0,r.kt)("h2",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"QueryResponse"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"ManyResponse"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",">"),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"ManyQueryResponse"))))),(0,r.kt)("h2",{id:"implements"},"Implements"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"IManyQueryResponse")),"<",(0,r.kt)("inlineCode",{parentName:"li"},"T"),">")),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new ManyQueryResponse"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"status"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"message"),")"),(0,r.kt)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"status")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Status")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Status of Execution ('SUCCESS' ","|"," 'FAILURE')")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"message")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ManyResponse"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"-")))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,"QueryResponse","<","ManyResponse","<","T\\",">","\\",">",".constructor"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/types.ts#L76"},"handler/types.ts:76")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"message"},"message"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"message"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ManyResponse"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">"),(0,r.kt)("h4",{id:"implementation-of"},"Implementation of"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IManyQueryResponse"},"IManyQueryResponse"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IManyQueryResponse#message"},"message")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,"QueryResponse.message"),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/types.ts#L11"},"handler/types.ts:11")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"status"},"status"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"status"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Status")),(0,r.kt)("h4",{id:"implementation-of-1"},"Implementation of"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IManyQueryResponse"},"IManyQueryResponse"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IManyQueryResponse#status"},"status")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,"QueryResponse.status"),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/types.ts#L10"},"handler/types.ts:10")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6635],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>c});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var p=a.createContext({}),o=function(e){var t=a.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},d=function(e){var t=o(e.components);return a.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,s=e.originalType,p=e.parentName,d=l(e,["components","mdxType","originalType","parentName"]),u=o(n),c=r,y=u["".concat(p,".").concat(c)]||u[c]||m[c]||s;return n?a.createElement(y,i(i({ref:t},d),{},{components:n})):a.createElement(y,i({ref:t},d))}));function c(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var s=n.length,i=new Array(s);i[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:r,i[1]=l;for(var o=2;o{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>s,metadata:()=>l,toc:()=>o});var a=n(7462),r=(n(7294),n(3905));const s={id:"ManyQueryResponse",title:"Class: ManyQueryResponse",sidebar_label:"ManyQueryResponse",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/ManyQueryResponse",id:"api/classes/ManyQueryResponse",title:"Class: ManyQueryResponse",description:"Response class for bulk operations.",source:"@site/docs/api/classes/ManyQueryResponse.md",sourceDirName:"api/classes",slug:"/api/classes/ManyQueryResponse",permalink:"/docs/api/classes/ManyQueryResponse",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ManyQueryResponse",title:"Class: ManyQueryResponse",sidebar_label:"ManyQueryResponse",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IndexParamsUsingGSIExceptions",permalink:"/docs/api/classes/IndexParamsUsingGSIExceptions"},next:{title:"MixedType",permalink:"/docs/api/classes/MixedType"}},p={},o=[{value:"Type parameters",id:"type-parameters",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Implements",id:"implements",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"Implementation of",id:"implementation-of",level:4},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"status",id:"status",level:3},{value:"Implementation of",id:"implementation-of-1",level:4},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4}],d={toc:o};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Response class for bulk operations."),(0,r.kt)("h2",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"QueryResponse"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"ManyResponse"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",">"),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"ManyQueryResponse"))))),(0,r.kt)("h2",{id:"implements"},"Implements"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"IManyQueryResponse")),"<",(0,r.kt)("inlineCode",{parentName:"li"},"T"),">")),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new ManyQueryResponse"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"status"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"message"),")"),(0,r.kt)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"status")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Status")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Status of Execution ('SUCCESS' ","|"," 'FAILURE')")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"message")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ManyResponse"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"-")))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,"QueryResponse","<","ManyResponse","<","T\\",">","\\",">",".constructor"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/types.ts#L76"},"handler/types.ts:76")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"message"},"message"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"message"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ManyResponse"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">"),(0,r.kt)("h4",{id:"implementation-of"},"Implementation of"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IManyQueryResponse"},"IManyQueryResponse"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IManyQueryResponse#message"},"message")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,"QueryResponse.message"),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/types.ts#L11"},"handler/types.ts:11")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"status"},"status"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"status"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Status")),(0,r.kt)("h4",{id:"implementation-of-1"},"Implementation of"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IManyQueryResponse"},"IManyQueryResponse"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IManyQueryResponse#status"},"status")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,"QueryResponse.status"),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/types.ts#L10"},"handler/types.ts:10")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/c2e30713.794bf593.js b/assets/js/c2e30713.bc86b4f4.js similarity index 95% rename from assets/js/c2e30713.794bf593.js rename to assets/js/c2e30713.bc86b4f4.js index b8a0c085..f265e58c 100644 --- a/assets/js/c2e30713.794bf593.js +++ b/assets/js/c2e30713.bc86b4f4.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6647],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||i;return n?r.createElement(m,o(o({ref:t},c),{},{components:n})):r.createElement(m,o({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(7462),a=(n(7294),n(3905));const i={id:"IStatusExecution",title:"Interface: IStatusExecution",sidebar_label:"IStatusExecution",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/interfaces/IStatusExecution",id:"api/interfaces/IStatusExecution",title:"Interface: IStatusExecution",description:"Properties",source:"@site/docs/api/interfaces/IStatusExecution.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IStatusExecution",permalink:"/docs/api/interfaces/IStatusExecution",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IStatusExecution",title:"Interface: IStatusExecution",sidebar_label:"IStatusExecution",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IModel",permalink:"/docs/api/interfaces/IModel"},next:{title:"ModelOptions",permalink:"/docs/api/interfaces/ModelOptions"}},s={},p=[{value:"Properties",id:"properties",level:2},{value:"exception",id:"exception",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"message",id:"message",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"payload",id:"payload",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"status",id:"status",level:3},{value:"Defined in",id:"defined-in-3",level:4}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"exception"},"exception"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"exception"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/types.ts#L21"},"handler/types.ts:21")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"message"},"message"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"message"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/types.ts#L22"},"handler/types.ts:22")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payload"},"payload"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"payload"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,a.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown"),">"),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/types.ts#L19"},"handler/types.ts:19")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"status"},"status"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"status"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Status")),(0,a.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/handler/types.ts#L20"},"handler/types.ts:20")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6647],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var s=r.createContext({}),p=function(e){var t=r.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=p(e.components);return r.createElement(s.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},d=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),d=p(n),f=a,m=d["".concat(s,".").concat(f)]||d[f]||u[f]||i;return n?r.createElement(m,o(o({ref:t},c),{},{components:n})):r.createElement(m,o({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=d;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var r=n(7462),a=(n(7294),n(3905));const i={id:"IStatusExecution",title:"Interface: IStatusExecution",sidebar_label:"IStatusExecution",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/interfaces/IStatusExecution",id:"api/interfaces/IStatusExecution",title:"Interface: IStatusExecution",description:"Properties",source:"@site/docs/api/interfaces/IStatusExecution.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IStatusExecution",permalink:"/docs/api/interfaces/IStatusExecution",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IStatusExecution",title:"Interface: IStatusExecution",sidebar_label:"IStatusExecution",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IModel",permalink:"/docs/api/interfaces/IModel"},next:{title:"ModelOptions",permalink:"/docs/api/interfaces/ModelOptions"}},s={},p=[{value:"Properties",id:"properties",level:2},{value:"exception",id:"exception",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"message",id:"message",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"payload",id:"payload",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"status",id:"status",level:3},{value:"Defined in",id:"defined-in-3",level:4}],c={toc:p};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"exception"},"exception"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"exception"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/types.ts#L21"},"handler/types.ts:21")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"message"},"message"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"message"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/types.ts#L22"},"handler/types.ts:22")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"payload"},"payload"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"payload"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,a.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,a.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,a.kt)("inlineCode",{parentName:"p"},"unknown"),">"),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/types.ts#L19"},"handler/types.ts:19")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"status"},"status"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"status"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"Status")),(0,a.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/handler/types.ts#L20"},"handler/types.ts:20")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ca85dbe4.3d5d03e6.js b/assets/js/ca85dbe4.2bd16799.js similarity index 95% rename from assets/js/ca85dbe4.3d5d03e6.js rename to assets/js/ca85dbe4.2bd16799.js index bb0e3ae5..2ee032d0 100644 --- a/assets/js/ca85dbe4.3d5d03e6.js +++ b/assets/js/ca85dbe4.2bd16799.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[549],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>u});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=o(a),u=r,c=k["".concat(d,".").concat(u)]||k[u]||m[u]||i;return a?n.createElement(c,l(l({ref:t},s),{},{components:a})):n.createElement(c,l({ref:t},s))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"ArrayType",title:"Class: ArrayType",sidebar_label:"ArrayType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/ArrayType",id:"api/classes/ArrayType",title:"Class: ArrayType",description:"Array type supports arrays of SchemaTypes and arrays of subdocuments.",source:"@site/docs/api/classes/ArrayType.md",sourceDirName:"api/classes",slug:"/api/classes/ArrayType",permalink:"/docs/api/classes/ArrayType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ArrayType",title:"Class: ArrayType",sidebar_label:"ArrayType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"VALIDATION_STRATEGY",permalink:"/docs/api/enums/VALIDATION_STRATEGY"},next:{title:"BooleanType",permalink:"/docs/api/classes/BooleanType"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"itemType",id:"itemtype",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-15",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Array type supports arrays of ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/schema.html"},"SchemaTypes")," and arrays of subdocuments."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field, allowed function, object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, allowed and value or function to generate it"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const postSchemaDef = new Schema({\n postTags: [String],\n comments: [{ type: commentSchema, ref: 'Comment' }],\n});\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"ArrayType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new ArrayType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"itemType"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"itemType")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/IOttomanType"},(0,r.kt)("inlineCode",{parentName:"a"},"IOttomanType")))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/array-type.ts#L26"},"schema/types/array-type.ts:26")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"itemtype"},"itemType"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"itemType"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},(0,r.kt)("inlineCode",{parentName:"a"},"IOttomanType"))),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/array-type.ts#L26"},"schema/types/array-type.ts:26")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"Array.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/array-type.ts#L30"},"schema/types/array-type.ts:30")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/array-type.ts#L32"},"schema/types/array-type.ts:32")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strict?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/array-type.ts#L39"},"schema/types/array-type.ts:39")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[549],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>u});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function l(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):l(l({},t),e)),a},s=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),k=o(a),u=r,c=k["".concat(d,".").concat(u)]||k[u]||m[u]||i;return a?n.createElement(c,l(l({ref:t},s),{},{components:a})):n.createElement(c,l({ref:t},s))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=a.length,l=new Array(i);l[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const i={id:"ArrayType",title:"Class: ArrayType",sidebar_label:"ArrayType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/ArrayType",id:"api/classes/ArrayType",title:"Class: ArrayType",description:"Array type supports arrays of SchemaTypes and arrays of subdocuments.",source:"@site/docs/api/classes/ArrayType.md",sourceDirName:"api/classes",slug:"/api/classes/ArrayType",permalink:"/docs/api/classes/ArrayType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ArrayType",title:"Class: ArrayType",sidebar_label:"ArrayType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"VALIDATION_STRATEGY",permalink:"/docs/api/enums/VALIDATION_STRATEGY"},next:{title:"BooleanType",permalink:"/docs/api/classes/BooleanType"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"itemType",id:"itemtype",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-15",level:4}],s={toc:o};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Array type supports arrays of ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/schema.html"},"SchemaTypes")," and arrays of subdocuments."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field, allowed function, object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, allowed and value or function to generate it"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const postSchemaDef = new Schema({\n postTags: [String],\n comments: [{ type: commentSchema, ref: 'Comment' }],\n});\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"ArrayType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new ArrayType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"itemType"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"itemType")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/IOttomanType"},(0,r.kt)("inlineCode",{parentName:"a"},"IOttomanType")))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/array-type.ts#L26"},"schema/types/array-type.ts:26")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"itemtype"},"itemType"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"itemType"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/IOttomanType"},(0,r.kt)("inlineCode",{parentName:"a"},"IOttomanType"))),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/array-type.ts#L26"},"schema/types/array-type.ts:26")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"Array.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/array-type.ts#L30"},"schema/types/array-type.ts:30")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/array-type.ts#L32"},"schema/types/array-type.ts:32")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strict?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"true"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/array-type.ts#L39"},"schema/types/array-type.ts:39")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/ccdd5768.636aea85.js b/assets/js/ccdd5768.636aea85.js deleted file mode 100644 index d9543a10..00000000 --- a/assets/js/ccdd5768.636aea85.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[2786],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,m=r(e,["components","mdxType","originalType","parentName"]),d=c(n),u=o,h=d["".concat(s,".").concat(u)]||d[u]||p[u]||i;return n?a.createElement(h,l(l({ref:t},m),{},{components:n})):a.createElement(h,l({ref:t},m))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,l=new Array(i);l[0]=d;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r.mdxType="string"==typeof e?e:o,l[1]=r;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>i,metadata:()=>r,toc:()=>c});var a=n(7462),o=(n(7294),n(3905));const i={sidebar_position:5,title:"Ottoman Class"},l="Ottoman Class",r={unversionedId:"basic/ottoman",id:"basic/ottoman",title:"Ottoman Class",description:"Defining an Ottoman Instance",source:"@site/docs/basic/ottoman.md",sourceDirName:"basic",slug:"/basic/ottoman",permalink:"/docs/basic/ottoman",draft:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5,title:"Ottoman Class"},sidebar:"tutorialSidebar",previous:{title:"Documents",permalink:"/docs/basic/document"},next:{title:"Query Builder",permalink:"/docs/basic/query-builder"}},s={},c=[{value:"Defining an Ottoman Instance",id:"defining-an-ottoman-instance",level:2},{value:"Ottoman Constructor Options",id:"ottoman-constructor-options",level:2},{value:"Connections",id:"connections",level:2},{value:"Create a Connection",id:"create-a-connection",level:2},{value:"Connection String Anatomy",id:"connection-string-anatomy",level:3},{value:"Connection Options",id:"connection-options",level:2},{value:"Certificate Authentication",id:"certificate-authentication",level:2},{value:"Authenticating Ottoman by Certificate",id:"authenticating-ottoman-by-certificate",level:3},{value:"Default Ottoman Instance",id:"default-ottoman-instance",level:2},{value:"Using the standalone functions",id:"using-the-standalone-functions",level:2},{value:"Multiple Ottoman instances",id:"multiple-ottoman-instances",level:2},{value:"Closing Connections",id:"closing-connections",level:2},{value:"Not Using Scopes/Collections",id:"not-using-scopescollections",level:2},{value:"Bootstrapping",id:"bootstrapping",level:2},{value:"Setting Environment Variables",id:"setting-environment-variables",level:2},{value:"Events",id:"events",level:2},{value:"Event IndexOnline",id:"event-indexonline",level:3},{value:"Helper Functions",id:"helper-functions",level:2},{value:"Next Up",id:"next-up",level:2}],m={toc:c};function p(e){let{components:t,...i}=e;return(0,o.kt)("wrapper",(0,a.Z)({},m,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ottoman-class"},"Ottoman Class"),(0,o.kt)("h2",{id:"defining-an-ottoman-instance"},"Defining an Ottoman Instance"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},'import { Ottoman } from "./ottoman";\n\nconst ottoman = new Ottoman();\n')),(0,o.kt)("p",null,"Ottoman's instances are the backbone of Ottoman.js and the entry point to use the ODM in your app."),(0,o.kt)("h2",{id:"ottoman-constructor-options"},"Ottoman Constructor Options"),(0,o.kt)("p",null,"Ottoman allows you to modify it's settings, this is useful for database modeling or migration.\nOne example is changing the metadata key to define the model in your documents."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { Ottoman } from \"./ottoman\";\n\nconst ottoman = new Ottoman({\n modelKey: 'type'\n});\n")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"modelKey")," default value is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"_type"),", but maybe you want to change it to ",(0,o.kt)("inlineCode",{parentName:"p"},"type")," as it's described in the example above."),(0,o.kt)("p",null,"The available configurations are:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"interface OttomanConfig {\n collectionName?: string;\n scopeName?: string;\n idKey?: string;\n modelKey?: string;\n populateMaxDeep?: number;\n consistency?: SearchConsistency;\n maxExpiry?: number;\n keyGenerator?: (params: { metadata: ModelMetadata }) => string;\n keyGeneratorDelimiter?: string;\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"collectionName"),": Store value to use for each Model if not provided. Default: Model's name"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"scopeName"),": Store value to use for each Model if not provided. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"_default")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"idKey"),": Value of the key to save your ",(0,o.kt)("strong",{parentName:"li"},"id"),". Default: Document's ",(0,o.kt)("inlineCode",{parentName:"li"},"id")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"modelKey"),": Key to store the model name into the document. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"_type")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"populateMaxDeep"),": Numeric Value for how many levels deep you want to ",(0,o.kt)("em",{parentName:"li"},"_populate"),". Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"1")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"consistency"),": Value for ",(0,o.kt)("em",{parentName:"li"},"Search Consistency Strategy"),". Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"SearchConsistency.NONE")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"maxExpiry"),": Numeric value (based in Milliseconds) used to create a collection for this instance. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"0")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"keyGenerator"),": Function to generate the key to store documents. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"(params: { metadata: ModelMetadata }) => string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"keyGeneratorDelimiter"),": String value used to build the document key. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"::"))),(0,o.kt)("p",null,"The default implementation for the ",(0,o.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function is:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"KEY_GENERATOR = ({ metadata }) => `${metadata.modelName}`;\n")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"keyGenerator")," can be overridden for each ",(0,o.kt)("inlineCode",{parentName:"p"},"Model")," if needed. check this in ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model.html#model-options"},"model options")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"keyGeneratorDelimiter")," has 2 restrictions:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Only supports up to 2 characters"),(0,o.kt)("li",{parentName:"ol"},"The available characters are ",(0,o.kt)("inlineCode",{parentName:"li"},"~!#$%&*_\\-:<>?"))),(0,o.kt)("admonition",{title:"Warning",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"If the value provided to ",(0,o.kt)("inlineCode",{parentName:"p"},"keyGeneratorDelimiter")," is invalid Ottoman will throw a ",(0,o.kt)("strong",{parentName:"p"},"BadKeyGeneratorDelimiterError")," exception.")),(0,o.kt)("p",null,"Some examples of ",(0,o.kt)("inlineCode",{parentName:"p"},"keyGeneratorDelimiter"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"::")," *",(0,o.kt)("em",{parentName:"li"},"default")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"&")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"&?")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"_")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"##"))),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"keyGeneratorDelimiter")," can be overridden for each ",(0,o.kt)("inlineCode",{parentName:"p"},"Model")," if needed. For more info see: ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model.html#model-options"},"model options")),(0,o.kt)("h2",{id:"connections"},"Connections"),(0,o.kt)("p",null,"All your ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model"},"Models")," will be created via a connection and it will map to a Collection."),(0,o.kt)("h2",{id:"create-a-connection"},"Create a Connection"),(0,o.kt)("p",null,"You can connect to Couchbase Server with the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/ottoman.html#connect"},"connect()")," method."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Ottoman } from 'ottoman';\n\nconst ottoman = new Ottoman();\n\nconst main = async () => {\n await ottoman.connect('couchbase://localhost/travel-sample@admin:password');\n // connected to Couchbase Server\n}\n\nmain();\n")),(0,o.kt)("p",null,"This is the minimum needed to connect to the travel-sample bucket.\nIf the connection fails on your machine, try using ",(0,o.kt)("inlineCode",{parentName:"p"},"127.0.0.1")," instead of ",(0,o.kt)("inlineCode",{parentName:"p"},"localhost"),"."),(0,o.kt)("h3",{id:"connection-string-anatomy"},"Connection String Anatomy"),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"Connection Anatomy",src:n(4610).Z,width:"1055",height:"237"})),(0,o.kt)("h2",{id:"connection-options"},"Connection Options"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"connect")," function also supports a JavaScript object as a parameter."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Ottoman } from 'ottoman';\n\nconst ottoman = new Ottoman();\n\nconst main = async () => {\n await ottoman.connect({\n connectionString: 'couchbase://localhost',\n bucketName: 'travel-sample',\n username: 'admin',\n password: 'password'\n });\n}\n\nmain();\n")),(0,o.kt)("p",null,"The available connections options are:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"interface ConnectOptions {\n connectionString: string;\n username: string;\n password: string;\n bucketName: string;\n authenticator?: CertificateAuthenticator;\n trustStorePath?: string;\n transcoder?: unknown;\n logFunc?: unknown;\n}\n")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"transcoder"),": Provides an interface for performing custom transcoding of document contents being retrieved and stored to the cluster. For more details see ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/nodejs-sdk/current/howtos/transcoders-nonjson.html"},"transcoders-nonjson"),".\n",(0,o.kt)("inlineCode",{parentName:"p"},"logFunc"),": A callback function that receives the ",(0,o.kt)("inlineCode",{parentName:"p"},"entry")," variable as paramater."),(0,o.kt)("h2",{id:"certificate-authentication"},"Certificate Authentication"),(0,o.kt)("p",null,"Couchbase Server supports the use of ",(0,o.kt)("strong",{parentName:"p"},"X.509")," certificates to authenticate clients (only available in the Enterprise Edition, not Community Edition). This allows authenticated users to access specific resources using the data service in Couchbase Server 5.1 and up and all other services in more recent releases of Couchbase Data Platform."),(0,o.kt)("p",null,"The process relies on a certificate authority for the issuing of certificates that validate identities. A certificate includes information such as the name of the entity it identifies, an expiration date, the name of the authority that issued the certificate, and the digital signature of the authority. A client attempting to access Couchbase Server can present a certificate to the server allowing the server to check the validity of the certificate. If the certificate is valid, the user under whose identity the client is running and the roles assigned to that user are verified. If the assigned roles are appropriate for the level of access requested to the specified resource, access is granted."),(0,o.kt)("p",null,"For a more detailed conceptual description of using certificates, see ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/7.0/learn/security/certificates.html"},"Certificates"),"."),(0,o.kt)("h3",{id:"authenticating-ottoman-by-certificate"},"Authenticating Ottoman by Certificate"),(0,o.kt)("p",null,"For sample procedures whereby certificates can be generated and deployed,\nsee ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/6.5/manage/manage-security/manage-certificates.html"},"Manage Certificates"),"."),(0,o.kt)("p",null,"The rest of this document assumes that the processes there, or something similar, have been followed. That is, a cluster certificate has been created and installed on the server, a client certificate has been created, and it is stored in a JVM Keystore along with the cluster\u2019s certificate."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { Ottoman, CertificateAuthenticator } from 'ottoman';\nconst ottoman = new Ottoman();\n\nconst main = async () => {\n await ottoman.connect({\n connectionString: 'couchbases://localhost',\n bucketName: 'travel-sample',\n authenticator: new CertificateAuthenticator(\n \"/path/to/client/certificate.pem\",\n \"/path/to/client/key.pem\"\n ),\n trustStorePath: \"/path/to/ca/certificates.pem\"\n })\n}\n\nmain();\n")),(0,o.kt)("h2",{id:"default-ottoman-instance"},"Default Ottoman Instance"),(0,o.kt)("p",null,"Ottoman creates an instance by default to make the job easier."),(0,o.kt)("p",null,"This instance is stored in the NodeJS process where the application runs and allows to use of the standalone functions ",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),",",(0,o.kt)("inlineCode",{parentName:"p"}," model"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"start"),",",(0,o.kt)("inlineCode",{parentName:"p"}," close"),"."),(0,o.kt)("p",null,"Let's see an example of how to create an Ottoman application."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman, connect, model, start} from 'ottoman';\n\nconst main = async () => {\n // Create the ottoman instance\n const ottoman = new Ottoman();\n\n // Connect to DB\n await connect('couchbase://localhost/travel-sample@admin:password');\n\n // Define your model\n const User = model ('User', {name: String});\n\n // Bootstrap the application\n await start();\n}\n\nmain();\n")),(0,o.kt)("p",null,"Notice: We do not have to explicitly call the ",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"model"),", or ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," methods using the Ottoman instance, since the first Ottoman instance created is registered and stored as the default instance which will be used by the standalone under the hood functions."),(0,o.kt)("p",null,"e.g. ",(0,o.kt)("inlineCode",{parentName:"p"},"connect(...)")," will run for the default instance like this ",(0,o.kt)("inlineCode",{parentName:"p"},"getDefaultInstance().connect(...)")," Ottoman handles this logic for you."),(0,o.kt)("p",null,"The default instance can be obtained with the ",(0,o.kt)("inlineCode",{parentName:"p"},"getDefaultInstance")," function, which will return the default instance if it was created or",(0,o.kt)("inlineCode",{parentName:"p"}," undefined")," otherwise."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman, getDefaultInstance} from 'ottoman';\nconst ottoman1 = new Ottoman ();\nconst ottoman2 = new Ottoman ();\n\n// Getting default instance\nconst defaultInstance = getDefaultInstance ();\n// defaultInstance = ottoman1\n")),(0,o.kt)("p",null,"This can greatly simplify work in modular applications."),(0,o.kt)("h2",{id:"using-the-standalone-functions"},"Using the standalone functions"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { connect, model } from 'ottoman';\n\nconst main = async () => {\n // connecting to server\n await connect('couchbase://localhost/travel-sample@admin:password');\n\n // Now you can use the model function to create Models in the default instance\n const User = model('User', { name: String });\n}\n\nmain();\n")),(0,o.kt)("p",null,"::: tip\nNotice we ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/ottoman.html#start"},"start")," using Ottoman without creating any instance, it's possible by using the ",(0,o.kt)("inlineCode",{parentName:"p"},"connect")," function.\n",(0,o.kt)("inlineCode",{parentName:"p"},"connect")," function will create a default ottoman instance with default options if there's not an ottoman default instance created yet.\n:::"),(0,o.kt)("p",null,"IMPORTANT: This will be the recommended way to use ",(0,o.kt)("inlineCode",{parentName:"p"},"Ottoman")," if your app uses only 1 instance.\nThis way ottoman will save for you the Ottoman instance to work in any place of your code."),(0,o.kt)("p",null,"Example ",(0,o.kt)("inlineCode",{parentName:"p"},"model")," instead of ",(0,o.kt)("inlineCode",{parentName:"p"},"ottoman.model"),".\nAlso there are ",(0,o.kt)("inlineCode",{parentName:"p"},"start"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"close"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"getDefaultInstance"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"getCollections")," functions are available for Ottoman default instance."),(0,o.kt)("h2",{id:"multiple-ottoman-instances"},"Multiple Ottoman instances"),(0,o.kt)("p",null,"Sometimes it is necessary to use different databases in the same application for some reason, it is not the common case but it is perfectly probable that at some point you will come across this use case. Ottoman provides multiple instance creation to solve this requirement, let's see how it works:"),(0,o.kt)("p",null,"So far we have used the default instance to connect, create the models, and even to start the application through the autonomous functions ",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),",",(0,o.kt)("inlineCode",{parentName:"p"}," model"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"start"),". These functions use the instance that Ottoman creates by default on the back to facilitate its handling, in this way the developer does not have to control the reference to the app instance. This works well and simplifies the work a lot, but sometimes it is necessary to use several databases in the same application, which Ottoman solves through multiple instances"),(0,o.kt)("p",null,"let's see an example:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Create the instance and connect it to the DB")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman} from 'ottoman';\n\nconst ottoman = new Ottoman ();\nawait ottoman.connect('couchbase://localhost/travel-sample@admin:password')\n")),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Create the models and start Ottoman.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman} from 'ottoman';\n\nconst main = async () => {\n const ottoman = new Ottoman ();\n await ottoman.connect('couchbase://localhost/travel-sample@admin:password')\n\n const User = ottoman.model ('User', schema)\n\n await ottoman.start()\n}\n\nmain();\n")),(0,o.kt)("p",null,"With these simple steps, we create an Ottoman application as simple as possible."),(0,o.kt)("p",null,"If we want to have multiple instances, we only have to repeat the steps described above, the code to create 2 instances would be left in this way:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman} from 'ottoman';\n\n\nconst main = async () => {\n const ottoman1 = new Ottoman ();\n await ottoman1.connect('couchbase://localhost/travel-sample@admin:password');\n\n const ottoman2 = new Ottoman ();\n await ottoman2.connect('couchbase://localhost/other-bucket@admin:password');\n\n// After connect you can create an explicitly Model from a given instance\n\n// Creating UserModel from ottoman1\n const UserModel = ottoman1.model ('User', {name: String});\n\n// Creating CatModel from ottoman2\n const CatModel = ottoman2.model ('Cat', {age: Number});\n}\n\nmain();\n")),(0,o.kt)("p",null,"You can create as many Ottoman instances as you need, there is not a defined limit."),(0,o.kt)("admonition",{title:"Strongly recommended for multiples instances",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"When working with multiple instances avoid using the standalone functions (",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"model"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"start"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"close"),"), the recommended way is to use the desired Ottoman instance as a prefix ensuring that each component is registered in the correct instance."),(0,o.kt)("p",{parentName:"admonition"},"Example:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-js"},"// working with multiple instances\nawait ottoman1.connect('couchbase://localhost/travel-sample@admin:password');\nawait ottoman2.connect('couchbase://localhost/other-bucket@admin:password');\n\n// not recommended\nconst User = model(User, schema);\n\n// Recommended (register explicitly model User to the ottoman2 Instance)\nconst User = ottoman2.model(User, schema);\n"))),(0,o.kt)("h2",{id:"closing-connections"},"Closing Connections"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Ottoman } from 'ottoman';\nconst ottoman1 = new Ottoman();\nawait ottoman1.connect('couchbase://localhost/travel-sample@admin:password');\n\n// Closing connection1\nottoman1.close();\n\n// Or just call the `close` function to close the default ottoman instance connection.\n// In this case, the `ottoman1` connection will be closed\nclose();\n")),(0,o.kt)("p",null,"::: tip\nAlways remember to close your connections.\n:::"),(0,o.kt)("h2",{id:"not-using-scopescollections"},"Not Using Scopes/Collections"),(0,o.kt)("p",null,"If you don't want to use the ",(0,o.kt)("strong",{parentName:"p"},"scopes and collections")," approach, set the ottoman instances this way:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { Ottoman } from \"./ottoman\";\n\nconst ottoman = new Ottoman({ collectionName: '_default' });\n")),(0,o.kt)("p",null,"This way Ottoman will store all your data in a bucket."),(0,o.kt)("h2",{id:"bootstrapping"},"Bootstrapping"),(0,o.kt)("p",null,"The ",(0,o.kt)("strong",{parentName:"p"},"Ottoman")," class will provide three main methods to bootstrap the app:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"ensureCollections")," will attempt to create collections and scopes for each model"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"ensureIndexes")," will attempt to create all indexes defined in the schema definition"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/ottoman.html#start"},"start")," method is just a shortcut to run ",(0,o.kt)("inlineCode",{parentName:"li"},"ensureCollections")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"ensureIndexes"))),(0,o.kt)("p",null,"Notice: It's not required to execute the ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," method for Ottoman work."),(0,o.kt)("h2",{id:"setting-environment-variables"},"Setting Environment Variables"),(0,o.kt)("p",null,"Ottoman provides a ",(0,o.kt)("inlineCode",{parentName:"p"},"set")," function to help you define environment variables.\nThe next example will show how to set debug mode:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { set } from 'ottoman';\n\n// Setting Ottoman in debuggin mode\nset('DEBUG', true);\n")),(0,o.kt)("p",null,"Remember: You must define your environment variables at the very beginning."),(0,o.kt)("h2",{id:"events"},"Events"),(0,o.kt)("p",null,"Ottoman will enable you to handle some events:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"IndexOnline"))),(0,o.kt)("h3",{id:"event-indexonline"},"Event IndexOnline"),(0,o.kt)("p",null,"This event will be trigger when the Ottoman's instance N1QL indexes are online to be used."),(0,o.kt)("p",null,"usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { Ottoman } from 'ottoman';\n\nconst ottoman = new Ottoman();\n\nconst main = async () => {\n await ottoman.connect(...)\n \n ... // do some stuff\n \n await ottoman.start(); // Ottoman start will attempt to create scope/collections and indexes\n \n // sometimes you will need to use the `IndexOnline` event\n // to ensure the indexes were built and all the documents were indexed\n // to can accept queries.\n ottoman.on('IndexOnline', (err) => {\n if (!err) {\n // this way you can start your web-server with your database ready to work.\n app.listen(4000);\n }\n console.log(err);\n })\n}\n")),(0,o.kt)("p",null,"Notice: ",(0,o.kt)("inlineCode",{parentName:"p"},"IndexOnline")," event will depend on ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," been called to be executed."),(0,o.kt)("h2",{id:"helper-functions"},"Helper Functions"),(0,o.kt)("p",null,"Ottoman provides these helpers functions:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/ottoman.html#dropbucket"},"dropBucket")," drops a bucket from the cluster."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/ottoman.html#dropscope"},"dropScope")," drops a scope from a bucket."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/ottoman.html#dropcollection"},"dropCollection")," drops a collection from a scope in a bucket.")),(0,o.kt)("h2",{id:"next-up"},"Next Up"),(0,o.kt)("p",null,"Great job! Now we're connected, let's take a look at ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema"},"Schemas"),"."))}p.isMDXComponent=!0},4610:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/connection-anatomy-04ff036d93ef340e6c7d1fc30337b52a.png"}}]); \ No newline at end of file diff --git a/assets/js/ccdd5768.832b4a81.js b/assets/js/ccdd5768.832b4a81.js new file mode 100644 index 00000000..2fb4f3f2 --- /dev/null +++ b/assets/js/ccdd5768.832b4a81.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[2786],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var a=n(7294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var s=a.createContext({}),c=function(e){var t=a.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=c(e.components);return a.createElement(s.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},d=a.forwardRef((function(e,t){var n=e.components,o=e.mdxType,i=e.originalType,s=e.parentName,m=r(e,["components","mdxType","originalType","parentName"]),d=c(n),u=o,h=d["".concat(s,".").concat(u)]||d[u]||p[u]||i;return n?a.createElement(h,l(l({ref:t},m),{},{components:n})):a.createElement(h,l({ref:t},m))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var i=n.length,l=new Array(i);l[0]=d;var r={};for(var s in t)hasOwnProperty.call(t,s)&&(r[s]=t[s]);r.originalType=e,r.mdxType="string"==typeof e?e:o,l[1]=r;for(var c=2;c{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>l,default:()=>p,frontMatter:()=>i,metadata:()=>r,toc:()=>c});var a=n(7462),o=(n(7294),n(3905));const i={sidebar_position:5,title:"Ottoman Class"},l="Ottoman Class",r={unversionedId:"basic/ottoman",id:"basic/ottoman",title:"Ottoman Class",description:"Defining an Ottoman Instance",source:"@site/docs/basic/ottoman.md",sourceDirName:"basic",slug:"/basic/ottoman",permalink:"/docs/basic/ottoman",draft:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5,title:"Ottoman Class"},sidebar:"tutorialSidebar",previous:{title:"Documents",permalink:"/docs/basic/document"},next:{title:"Query Builder",permalink:"/docs/basic/query-builder"}},s={},c=[{value:"Defining an Ottoman Instance",id:"defining-an-ottoman-instance",level:2},{value:"Ottoman Constructor Options",id:"ottoman-constructor-options",level:2},{value:"Connections",id:"connections",level:2},{value:"Create a Connection",id:"create-a-connection",level:2},{value:"Connection String Anatomy",id:"connection-string-anatomy",level:3},{value:"Connection Options",id:"connection-options",level:2},{value:"Certificate Authentication",id:"certificate-authentication",level:2},{value:"Authenticating Ottoman by Certificate",id:"authenticating-ottoman-by-certificate",level:3},{value:"Default Ottoman Instance",id:"default-ottoman-instance",level:2},{value:"Using the standalone functions",id:"using-the-standalone-functions",level:2},{value:"Multiple Ottoman instances",id:"multiple-ottoman-instances",level:2},{value:"Closing Connections",id:"closing-connections",level:2},{value:"Not Using Scopes/Collections",id:"not-using-scopescollections",level:2},{value:"Bootstrapping",id:"bootstrapping",level:2},{value:"Setting Environment Variables",id:"setting-environment-variables",level:2},{value:"Events",id:"events",level:2},{value:"Event IndexOnline",id:"event-indexonline",level:3},{value:"Helper Functions",id:"helper-functions",level:2},{value:"Next Up",id:"next-up",level:2}],m={toc:c};function p(e){let{components:t,...i}=e;return(0,o.kt)("wrapper",(0,a.Z)({},m,i,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"ottoman-class"},"Ottoman Class"),(0,o.kt)("h2",{id:"defining-an-ottoman-instance"},"Defining an Ottoman Instance"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},'import { Ottoman } from "./ottoman";\n\nconst ottoman = new Ottoman();\n')),(0,o.kt)("p",null,"Ottoman's instances are the backbone of Ottoman.js and the entry point to use the ODM in your app."),(0,o.kt)("h2",{id:"ottoman-constructor-options"},"Ottoman Constructor Options"),(0,o.kt)("p",null,"Ottoman allows you to modify it's settings, this is useful for database modeling or migration.\nOne example is changing the metadata key to define the model in your documents."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { Ottoman } from \"./ottoman\";\n\nconst ottoman = new Ottoman({\n modelKey: 'type'\n});\n")),(0,o.kt)("p",null,"The ",(0,o.kt)("inlineCode",{parentName:"p"},"modelKey")," default value is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"_type"),", but maybe you want to change it to ",(0,o.kt)("inlineCode",{parentName:"p"},"type")," as it's described in the example above."),(0,o.kt)("p",null,"The available configurations are:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"interface OttomanConfig {\n collectionName?: string;\n scopeName?: string;\n idKey?: string;\n modelKey?: string;\n populateMaxDeep?: number;\n consistency?: SearchConsistency;\n maxExpiry?: number;\n keyGenerator?: (params: { metadata: ModelMetadata }) => string;\n keyGeneratorDelimiter?: string;\n}\n")),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"collectionName"),": Store value to use for each Model if not provided. Default: Model's name"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"scopeName"),": Store value to use for each Model if not provided. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"_default")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"idKey"),": Value of the key to save your ",(0,o.kt)("strong",{parentName:"li"},"id"),". Default: Document's ",(0,o.kt)("inlineCode",{parentName:"li"},"id")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"modelKey"),": Key to store the model name into the document. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"_type")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"populateMaxDeep"),": Numeric Value for how many levels deep you want to ",(0,o.kt)("em",{parentName:"li"},"_populate"),". Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"1")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"consistency"),": Value for ",(0,o.kt)("em",{parentName:"li"},"Search Consistency Strategy"),". Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"SearchConsistency.NONE")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"maxExpiry"),": Numeric value (based in Milliseconds) used to create a collection for this instance. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"0")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"keyGenerator"),": Function to generate the key to store documents. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"(params: { metadata: ModelMetadata }) => string")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"keyGeneratorDelimiter"),": String value used to build the document key. Default: ",(0,o.kt)("inlineCode",{parentName:"li"},"::"))),(0,o.kt)("p",null,"The default implementation for the ",(0,o.kt)("inlineCode",{parentName:"p"},"keyGenerator")," function is:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"KEY_GENERATOR = ({ metadata }) => `${metadata.modelName}`;\n")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"keyGenerator")," can be overridden for each ",(0,o.kt)("inlineCode",{parentName:"p"},"Model")," if needed. check this in ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model.html#model-options"},"model options")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"keyGeneratorDelimiter")," has 2 restrictions:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Only supports up to 2 characters"),(0,o.kt)("li",{parentName:"ol"},"The available characters are ",(0,o.kt)("inlineCode",{parentName:"li"},"~!#$%&*_\\-:<>?"))),(0,o.kt)("admonition",{title:"Warning",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"If the value provided to ",(0,o.kt)("inlineCode",{parentName:"p"},"keyGeneratorDelimiter")," is invalid Ottoman will throw a ",(0,o.kt)("strong",{parentName:"p"},"BadKeyGeneratorDelimiterError")," exception.")),(0,o.kt)("p",null,"Some examples of ",(0,o.kt)("inlineCode",{parentName:"p"},"keyGeneratorDelimiter"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"::")," *",(0,o.kt)("em",{parentName:"li"},"default")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"&")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"&?")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"_")),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"##"))),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"keyGeneratorDelimiter")," can be overridden for each ",(0,o.kt)("inlineCode",{parentName:"p"},"Model")," if needed. For more info see: ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model.html#model-options"},"model options")),(0,o.kt)("h2",{id:"connections"},"Connections"),(0,o.kt)("p",null,"All your ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/model"},"Models")," will be created via a connection and it will map to a Collection."),(0,o.kt)("h2",{id:"create-a-connection"},"Create a Connection"),(0,o.kt)("p",null,"You can connect to Couchbase Server with the ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/ottoman.html#connect"},"connect()")," method."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Ottoman } from 'ottoman';\n\nconst ottoman = new Ottoman();\n\nconst main = async () => {\n await ottoman.connect('couchbase://localhost/travel-sample@admin:password');\n // connected to Couchbase Server\n}\n\nmain();\n")),(0,o.kt)("p",null,"This is the minimum needed to connect to the travel-sample bucket.\nIf the connection fails on your machine, try using ",(0,o.kt)("inlineCode",{parentName:"p"},"127.0.0.1")," instead of ",(0,o.kt)("inlineCode",{parentName:"p"},"localhost"),"."),(0,o.kt)("h3",{id:"connection-string-anatomy"},"Connection String Anatomy"),(0,o.kt)("p",null,(0,o.kt)("img",{alt:"Connection Anatomy",src:n(4610).Z,width:"1055",height:"237"})),(0,o.kt)("h2",{id:"connection-options"},"Connection Options"),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"connect")," function also supports a JavaScript object as a parameter."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Ottoman } from 'ottoman';\n\nconst ottoman = new Ottoman();\n\nconst main = async () => {\n await ottoman.connect({\n connectionString: 'couchbase://localhost',\n bucketName: 'travel-sample',\n username: 'admin',\n password: 'password',\n });\n}\n\nmain();\n")),(0,o.kt)("p",null,"The available connections options are:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"interface ConnectOptions {\n connectionString: string;\n username: string;\n password: string;\n bucketName: string;\n authenticator?: CertificateAuthenticator;\n trustStorePath?: string;\n transcoder?: unknown;\n logFunc?: unknown;\n}\n")),(0,o.kt)("p",null,(0,o.kt)("inlineCode",{parentName:"p"},"transcoder"),": Provides an interface for performing custom transcoding of document contents being retrieved and stored to the cluster. For more details see ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/nodejs-sdk/current/howtos/transcoders-nonjson.html"},"transcoders-nonjson"),".\n",(0,o.kt)("inlineCode",{parentName:"p"},"logFunc"),": A callback function that receives the ",(0,o.kt)("inlineCode",{parentName:"p"},"entry")," variable as paramater."),(0,o.kt)("h2",{id:"certificate-authentication"},"Certificate Authentication"),(0,o.kt)("p",null,"Couchbase Server supports the use of ",(0,o.kt)("strong",{parentName:"p"},"X.509")," certificates to authenticate clients (only available in the Enterprise Edition, not Community Edition). This allows authenticated users to access specific resources using the data service in Couchbase Server 5.1 and up and all other services in more recent releases of Couchbase Data Platform."),(0,o.kt)("p",null,"The process relies on a certificate authority for the issuing of certificates that validate identities. A certificate includes information such as the name of the entity it identifies, an expiration date, the name of the authority that issued the certificate, and the digital signature of the authority. A client attempting to access Couchbase Server can present a certificate to the server allowing the server to check the validity of the certificate. If the certificate is valid, the user under whose identity the client is running and the roles assigned to that user are verified. If the assigned roles are appropriate for the level of access requested to the specified resource, access is granted."),(0,o.kt)("p",null,"For a more detailed conceptual description of using certificates, see ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/7.0/learn/security/certificates.html"},"Certificates"),"."),(0,o.kt)("h3",{id:"authenticating-ottoman-by-certificate"},"Authenticating Ottoman by Certificate"),(0,o.kt)("p",null,"For sample procedures whereby certificates can be generated and deployed,\nsee ",(0,o.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/6.5/manage/manage-security/manage-certificates.html"},"Manage Certificates"),"."),(0,o.kt)("p",null,"The rest of this document assumes that the processes there, or something similar, have been followed. That is, a cluster certificate has been created and installed on the server, a client certificate has been created, and it is stored in a JVM Keystore along with the cluster\u2019s certificate."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { Ottoman, CertificateAuthenticator } from 'ottoman';\nconst ottoman = new Ottoman();\n\nconst main = async () => {\n await ottoman.connect({\n connectionString: 'couchbases://localhost',\n bucketName: 'travel-sample',\n authenticator: new CertificateAuthenticator(\n \"/path/to/client/certificate.pem\",\n \"/path/to/client/key.pem\"\n ),\n trustStorePath: \"/path/to/ca/certificates.pem\"\n })\n}\n\nmain();\n")),(0,o.kt)("h2",{id:"default-ottoman-instance"},"Default Ottoman Instance"),(0,o.kt)("p",null,"Ottoman creates an instance by default to make the job easier."),(0,o.kt)("p",null,"This instance is stored in the NodeJS process where the application runs and allows to use of the standalone functions ",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),",",(0,o.kt)("inlineCode",{parentName:"p"}," model"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"start"),",",(0,o.kt)("inlineCode",{parentName:"p"}," close"),"."),(0,o.kt)("p",null,"Let's see an example of how to create an Ottoman application."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman, connect, model, start} from 'ottoman';\n\nconst main = async () => {\n // Create the ottoman instance\n const ottoman = new Ottoman();\n\n // Connect to DB\n await connect('couchbase://localhost/travel-sample@admin:password');\n\n // Define your model\n const User = model ('User', {name: String});\n\n // Bootstrap the application\n await start();\n}\n\nmain();\n")),(0,o.kt)("p",null,"Notice: We do not have to explicitly call the ",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"model"),", or ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," methods using the Ottoman instance, since the first Ottoman instance created is registered and stored as the default instance which will be used by the standalone under the hood functions."),(0,o.kt)("p",null,"e.g. ",(0,o.kt)("inlineCode",{parentName:"p"},"connect(...)")," will run for the default instance like this ",(0,o.kt)("inlineCode",{parentName:"p"},"getDefaultInstance().connect(...)")," Ottoman handles this logic for you."),(0,o.kt)("p",null,"The default instance can be obtained with the ",(0,o.kt)("inlineCode",{parentName:"p"},"getDefaultInstance")," function, which will return the default instance if it was created or",(0,o.kt)("inlineCode",{parentName:"p"}," undefined")," otherwise."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman, getDefaultInstance} from 'ottoman';\nconst ottoman1 = new Ottoman ();\nconst ottoman2 = new Ottoman ();\n\n// Getting default instance\nconst defaultInstance = getDefaultInstance ();\n// defaultInstance = ottoman1\n")),(0,o.kt)("p",null,"This can greatly simplify work in modular applications."),(0,o.kt)("h2",{id:"using-the-standalone-functions"},"Using the standalone functions"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { connect, model } from 'ottoman';\n\nconst main = async () => {\n // connecting to server\n await connect('couchbase://localhost/travel-sample@admin:password');\n\n // Now you can use the model function to create Models in the default instance\n const User = model('User', { name: String });\n}\n\nmain();\n")),(0,o.kt)("p",null,"::: tip\nNotice we ",(0,o.kt)("a",{parentName:"p",href:"/docs/api/classes/ottoman.html#start"},"start")," using Ottoman without creating any instance, it's possible by using the ",(0,o.kt)("inlineCode",{parentName:"p"},"connect")," function.\n",(0,o.kt)("inlineCode",{parentName:"p"},"connect")," function will create a default ottoman instance with default options if there's not an ottoman default instance created yet.\n:::"),(0,o.kt)("p",null,"IMPORTANT: This will be the recommended way to use ",(0,o.kt)("inlineCode",{parentName:"p"},"Ottoman")," if your app uses only 1 instance.\nThis way ottoman will save for you the Ottoman instance to work in any place of your code."),(0,o.kt)("p",null,"Example ",(0,o.kt)("inlineCode",{parentName:"p"},"model")," instead of ",(0,o.kt)("inlineCode",{parentName:"p"},"ottoman.model"),".\nAlso there are ",(0,o.kt)("inlineCode",{parentName:"p"},"start"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"close"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"getDefaultInstance"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"getCollections")," functions are available for Ottoman default instance."),(0,o.kt)("h2",{id:"multiple-ottoman-instances"},"Multiple Ottoman instances"),(0,o.kt)("p",null,"Sometimes it is necessary to use different databases in the same application for some reason, it is not the common case but it is perfectly probable that at some point you will come across this use case. Ottoman provides multiple instance creation to solve this requirement, let's see how it works:"),(0,o.kt)("p",null,"So far we have used the default instance to connect, create the models, and even to start the application through the autonomous functions ",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),",",(0,o.kt)("inlineCode",{parentName:"p"}," model"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"start"),". These functions use the instance that Ottoman creates by default on the back to facilitate its handling, in this way the developer does not have to control the reference to the app instance. This works well and simplifies the work a lot, but sometimes it is necessary to use several databases in the same application, which Ottoman solves through multiple instances"),(0,o.kt)("p",null,"let's see an example:"),(0,o.kt)("ol",null,(0,o.kt)("li",{parentName:"ol"},"Create the instance and connect it to the DB")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman} from 'ottoman';\n\nconst ottoman = new Ottoman ();\nawait ottoman.connect('couchbase://localhost/travel-sample@admin:password')\n")),(0,o.kt)("ol",{start:2},(0,o.kt)("li",{parentName:"ol"},"Create the models and start Ottoman.")),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman} from 'ottoman';\n\nconst main = async () => {\n const ottoman = new Ottoman ();\n await ottoman.connect('couchbase://localhost/travel-sample@admin:password')\n\n const User = ottoman.model ('User', schema)\n\n await ottoman.start()\n}\n\nmain();\n")),(0,o.kt)("p",null,"With these simple steps, we create an Ottoman application as simple as possible."),(0,o.kt)("p",null,"If we want to have multiple instances, we only have to repeat the steps described above, the code to create 2 instances would be left in this way:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-js"},"import {Ottoman} from 'ottoman';\n\n\nconst main = async () => {\n const ottoman1 = new Ottoman ();\n await ottoman1.connect('couchbase://localhost/travel-sample@admin:password');\n\n const ottoman2 = new Ottoman ();\n await ottoman2.connect('couchbase://localhost/other-bucket@admin:password');\n\n// After connect you can create an explicitly Model from a given instance\n\n// Creating UserModel from ottoman1\n const UserModel = ottoman1.model ('User', {name: String});\n\n// Creating CatModel from ottoman2\n const CatModel = ottoman2.model ('Cat', {age: Number});\n}\n\nmain();\n")),(0,o.kt)("p",null,"You can create as many Ottoman instances as you need, there is not a defined limit."),(0,o.kt)("admonition",{title:"Strongly recommended for multiples instances",type:"warning"},(0,o.kt)("p",{parentName:"admonition"},"When working with multiple instances avoid using the standalone functions (",(0,o.kt)("inlineCode",{parentName:"p"},"connect"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"model"),", ",(0,o.kt)("inlineCode",{parentName:"p"},"start"),", and ",(0,o.kt)("inlineCode",{parentName:"p"},"close"),"), the recommended way is to use the desired Ottoman instance as a prefix ensuring that each component is registered in the correct instance."),(0,o.kt)("p",{parentName:"admonition"},"Example:"),(0,o.kt)("pre",{parentName:"admonition"},(0,o.kt)("code",{parentName:"pre",className:"language-js"},"// working with multiple instances\nawait ottoman1.connect('couchbase://localhost/travel-sample@admin:password');\nawait ottoman2.connect('couchbase://localhost/other-bucket@admin:password');\n\n// not recommended\nconst User = model(User, schema);\n\n// Recommended (register explicitly model User to the ottoman2 Instance)\nconst User = ottoman2.model(User, schema);\n"))),(0,o.kt)("h2",{id:"closing-connections"},"Closing Connections"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-javascript"},"import { Ottoman } from 'ottoman';\nconst ottoman1 = new Ottoman();\nawait ottoman1.connect('couchbase://localhost/travel-sample@admin:password');\n\n// Closing connection1\nottoman1.close();\n\n// Or just call the `close` function to close the default ottoman instance connection.\n// In this case, the `ottoman1` connection will be closed\nclose();\n")),(0,o.kt)("p",null,"::: tip\nAlways remember to close your connections.\n:::"),(0,o.kt)("h2",{id:"not-using-scopescollections"},"Not Using Scopes/Collections"),(0,o.kt)("p",null,"If you don't want to use the ",(0,o.kt)("strong",{parentName:"p"},"scopes and collections")," approach, set the ottoman instances this way:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { Ottoman } from \"./ottoman\";\n\nconst ottoman = new Ottoman({ collectionName: '_default' });\n")),(0,o.kt)("p",null,"This way Ottoman will store all your data in a bucket."),(0,o.kt)("h2",{id:"bootstrapping"},"Bootstrapping"),(0,o.kt)("p",null,"The ",(0,o.kt)("strong",{parentName:"p"},"Ottoman")," class will provide three main methods to bootstrap the app:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"ensureCollections")," will attempt to create collections and scopes for each model"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"ensureIndexes")," will attempt to create all indexes defined in the schema definition"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/ottoman.html#start"},"start")," method is just a shortcut to run ",(0,o.kt)("inlineCode",{parentName:"li"},"ensureCollections")," and ",(0,o.kt)("inlineCode",{parentName:"li"},"ensureIndexes"))),(0,o.kt)("p",null,"Notice: It's not required to execute the ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," method for Ottoman work."),(0,o.kt)("h2",{id:"setting-environment-variables"},"Setting Environment Variables"),(0,o.kt)("p",null,"Ottoman provides a ",(0,o.kt)("inlineCode",{parentName:"p"},"set")," function to help you define environment variables.\nThe next example will show how to set debug mode:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { set } from 'ottoman';\n\n// Setting Ottoman in debuggin mode\nset('DEBUG', true);\n")),(0,o.kt)("p",null,"Remember: You must define your environment variables at the very beginning."),(0,o.kt)("h2",{id:"events"},"Events"),(0,o.kt)("p",null,"Ottoman will enable you to handle some events:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("inlineCode",{parentName:"li"},"IndexOnline"))),(0,o.kt)("h3",{id:"event-indexonline"},"Event IndexOnline"),(0,o.kt)("p",null,"This event will be trigger when the Ottoman's instance N1QL indexes are online to be used."),(0,o.kt)("p",null,"usage:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-typescript"},"import { Ottoman } from 'ottoman';\n\nconst ottoman = new Ottoman();\n\nconst main = async () => {\n await ottoman.connect(...)\n \n ... // do some stuff\n \n await ottoman.start(); // Ottoman start will attempt to create scope/collections and indexes\n \n // sometimes you will need to use the `IndexOnline` event\n // to ensure the indexes were built and all the documents were indexed\n // to can accept queries.\n ottoman.on('IndexOnline', (err) => {\n if (!err) {\n // this way you can start your web-server with your database ready to work.\n app.listen(4000);\n }\n console.log(err);\n })\n}\n")),(0,o.kt)("p",null,"Notice: ",(0,o.kt)("inlineCode",{parentName:"p"},"IndexOnline")," event will depend on ",(0,o.kt)("inlineCode",{parentName:"p"},"start")," or ",(0,o.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," been called to be executed."),(0,o.kt)("h2",{id:"helper-functions"},"Helper Functions"),(0,o.kt)("p",null,"Ottoman provides these helpers functions:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/ottoman.html#dropbucket"},"dropBucket")," drops a bucket from the cluster."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/ottoman.html#dropscope"},"dropScope")," drops a scope from a bucket."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"/docs/api/classes/ottoman.html#dropcollection"},"dropCollection")," drops a collection from a scope in a bucket.")),(0,o.kt)("h2",{id:"next-up"},"Next Up"),(0,o.kt)("p",null,"Great job! Now we're connected, let's take a look at ",(0,o.kt)("a",{parentName:"p",href:"/docs/basic/schema"},"Schemas"),"."))}p.isMDXComponent=!0},4610:(e,t,n)=>{n.d(t,{Z:()=>a});const a=n.p+"assets/images/connection-anatomy-04ff036d93ef340e6c7d1fc30337b52a.png"}}]); \ No newline at end of file diff --git a/assets/js/df7f7ec8.52803bc9.js b/assets/js/df7f7ec8.52803bc9.js new file mode 100644 index 00000000..5782568a --- /dev/null +++ b/assets/js/df7f7ec8.52803bc9.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[1505],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},m=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),k=p(n),u=r,c=k["".concat(d,".").concat(u)]||k[u]||s[u]||i;return n?a.createElement(c,l(l({ref:t},m),{},{components:n})):a.createElement(c,l({ref:t},m))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=k;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>s,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const i={id:"Ottoman",title:"Class: Ottoman",sidebar_label:"Ottoman",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/classes/Ottoman",id:"api/classes/Ottoman",title:"Class: Ottoman",description:"Constructors",source:"@site/docs/api/classes/Ottoman.md",sourceDirName:"api/classes",slug:"/api/classes/Ottoman",permalink:"/docs/api/classes/Ottoman",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Ottoman",title:"Class: Ottoman",sidebar_label:"Ottoman",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"NumberType",permalink:"/docs/api/classes/NumberType"},next:{title:"Query",permalink:"/docs/api/classes/Query"}},d={},p=[{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"_cluster",id:"_cluster",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"bucket",id:"bucket",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"bucketName",id:"bucketname",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"config",id:"config",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"couchbase",id:"couchbase",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"events",id:"events",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"id",id:"id",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"indexOnline",id:"indexonline",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"indexOnlinePromise",id:"indexonlinepromise",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"models",id:"models",level:3},{value:"Defined in",id:"defined-in-10",level:4},{value:"n1qlIndexes",id:"n1qlindexes",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"refdocIndexes",id:"refdocindexes",level:3},{value:"Defined in",id:"defined-in-12",level:4},{value:"viewIndexes",id:"viewindexes",level:3},{value:"Defined in",id:"defined-in-13",level:4},{value:"Accessors",id:"accessors",level:2},{value:"bucketManager",id:"bucketmanager",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"cluster",id:"cluster",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"collectionManager",id:"collectionmanager",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"indexReadyHooks",id:"indexreadyhooks",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"queryIndexManager",id:"queryindexmanager",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"viewIndexManager",id:"viewindexmanager",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-19",level:4},{value:"Methods",id:"methods",level:2},{value:"$transactions",id:"transactions",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"close",id:"close",level:3},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"connect",id:"connect",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"dropBucket",id:"dropbucket",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"dropCollection",id:"dropcollection",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-24",level:4},{value:"dropScope",id:"dropscope",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-25",level:4},{value:"ensureCollections",id:"ensurecollections",level:3},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-26",level:4},{value:"ensureIndexes",id:"ensureindexes",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Defined in",id:"defined-in-27",level:4},{value:"getCollection",id:"getcollection",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-14",level:4},{value:"Defined in",id:"defined-in-28",level:4},{value:"getIndexes",id:"getindexes",level:3},{value:"Returns",id:"returns-15",level:4},{value:"Defined in",id:"defined-in-29",level:4},{value:"getModel",id:"getmodel",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-16",level:4},{value:"Defined in",id:"defined-in-30",level:4},{value:"model",id:"model",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Defined in",id:"defined-in-31",level:4},{value:"on",id:"on",level:3},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Defined in",id:"defined-in-32",level:4},{value:"query",id:"query",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-19",level:4},{value:"Defined in",id:"defined-in-33",level:4},{value:"searchQuery",id:"searchquery",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Defined in",id:"defined-in-34",level:4},{value:"start",id:"start",level:3},{value:"Parameters",id:"parameters-13",level:4},{value:"Returns",id:"returns-21",level:4},{value:"Defined in",id:"defined-in-35",level:4}],m={toc:p};function s(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new Ottoman"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"config?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"config")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"OttomanConfig"))))),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L223"},"ottoman/ottoman.ts:223")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"_cluster"},"_","cluster"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"_","cluster"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Cluster")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L204"},"ottoman/ottoman.ts:204")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"bucket"},"bucket"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"bucket"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Bucket")),(0,r.kt)("p",null,"Bucket represents a storage grouping of data within a Couchbase Server cluster."),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L152"},"ottoman/ottoman.ts:152")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"bucketname"},"bucketName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"bucketName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"''")),(0,r.kt)("p",null,"Contains the name of the current bucket."),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L216"},"ottoman/ottoman.ts:216")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"config"},"config"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"config"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"OttomanConfig")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L147"},"ottoman/ottoman.ts:147")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"couchbase"},"couchbase"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"couchbase"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Stores a reference to couchbase instance."),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L221"},"ottoman/ottoman.ts:221")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"events"},"events"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"events"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},'"IndexOnline"'),", ",(0,r.kt)("inlineCode",{parentName:"p"},"NodeCallback"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">","[]",">"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L86"},"ottoman/ottoman.ts:86")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"id"},"id"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Readonly")," ",(0,r.kt)("strong",{parentName:"p"},"id"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L85"},"ottoman/ottoman.ts:85")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexonline"},"indexOnline"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"indexOnline"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Error")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"false")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L89"},"ottoman/ottoman.ts:89")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexonlinepromise"},"indexOnlinePromise"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"indexOnlinePromise"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L90"},"ottoman/ottoman.ts:90")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"models"},"models"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"models"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Object")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")),(0,r.kt)("p",null,"Dictionary for all models registered on this connection."),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L202"},"ottoman/ottoman.ts:202")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"n1qlindexes"},"n1qlIndexes"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"n1qlIndexes"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", { ",(0,r.kt)("inlineCode",{parentName:"p"},"fields"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[] ; ",(0,r.kt)("inlineCode",{parentName:"p"},"modelName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," }",">"," = ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L82"},"ottoman/ottoman.ts:82")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"refdocindexes"},"refdocIndexes"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"refdocIndexes"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", { ",(0,r.kt)("inlineCode",{parentName:"p"},"fields"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[] }[]",">"," = ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L84"},"ottoman/ottoman.ts:84")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"viewindexes"},"viewIndexes"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"viewIndexes"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", { ",(0,r.kt)("inlineCode",{parentName:"p"},"views"),": { ",(0,r.kt)("inlineCode",{parentName:"p"},"map?"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," } }",">"," = ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L83"},"ottoman/ottoman.ts:83")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"bucketmanager"},"bucketManager"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"bucketManager"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"BucketManager")),(0,r.kt)("p",null,"Gets a bucket manager for this cluster."),(0,r.kt)("p",null,"Check the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/BucketManager.html"},"Bucket Manager Couchbase SDK API"),"\ndocumentation for more details."),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BucketManager")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L172"},"ottoman/ottoman.ts:172")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cluster"},"cluster"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"cluster"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Cluster")),(0,r.kt)("p",null,"Cluster represents an entire Couchbase Server cluster."),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Cluster")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L209"},"ottoman/ottoman.ts:209")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"collectionmanager"},"collectionManager"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"collectionManager"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"CollectionManager")),(0,r.kt)("p",null,"CollectionManager allows the management of collections within a Bucket."),(0,r.kt)("p",null,"Check the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/CollectionManager.html"},"Collection Manager Couchbase SDK API"),"\ndocumentation for more details."),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"CollectionManager")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L161"},"ottoman/ottoman.ts:161")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexreadyhooks"},"indexReadyHooks"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"indexReadyHooks"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"NodeCallback"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">","[]"),(0,r.kt)("p",null,'Retrieve all register callbacks to "IndexOnline" event'),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"NodeCallback"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">","[]"),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L95"},"ottoman/ottoman.ts:95")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"queryindexmanager"},"queryIndexManager"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"queryIndexManager"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"QueryIndexManager")),(0,r.kt)("p",null,"QueryIndexManager provides an interface for managing the query indexes on the cluster."),(0,r.kt)("p",null,"Check the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/QueryIndexManager.html"},"Query Index Manager Couchbase SDK API"),"\ndocumentation for more details."),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"QueryIndexManager")),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L183"},"ottoman/ottoman.ts:183")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"viewindexmanager"},"viewIndexManager"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"viewIndexManager"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"ViewIndexManager")),(0,r.kt)("p",null,"ViewIndexManager is an interface which enables the management of view indexes on the cluster."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Deprecated"))),(0,r.kt)("p",null,"Check the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/ViewIndexManager.html"},"View Index Manager Couchbase SDK API"),"\ndocumentation for more details."),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"ViewIndexManager")),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L195"},"ottoman/ottoman.ts:195")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"transactions"},"$transactions"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"$transactions"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"transactionFn"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"config?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,"The ",(0,r.kt)("inlineCode",{parentName:"p"},"$transactions")," function passes a ",(0,r.kt)("inlineCode",{parentName:"p"},"TransactionAttemptContext")," object to the transaction function."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'await otttoman.$transactions(async (ctx: TransactionAttemptContext) => {\n const user = await User.create({ name: "John Doe" }, { transactionContext: ctx });\n});\n')),(0,r.kt)("p",null,"Notice: You ",(0,r.kt)("strong",{parentName:"p"},"MUST pass the ",(0,r.kt)("inlineCode",{parentName:"strong"},"transactionContext")," option in the model methods")," to execute the operation(s) as a transaction."),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"transactionFn")),(0,r.kt)("td",{parentName:"tr",align:"left"},"(",(0,r.kt)("inlineCode",{parentName:"td"},"attempt"),": ",(0,r.kt)("inlineCode",{parentName:"td"},"TransactionAttemptContext"),") => ",(0,r.kt)("inlineCode",{parentName:"td"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"void"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"The function to be executed as a transaction.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"config?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"TransactionOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"durabilityLevel"),": Specifies the level of synchronous durability level. - ",(0,r.kt)("inlineCode",{parentName:"td"},"timeout"),": Specifies the timeout for the transaction.")))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L517"},"ottoman/ottoman.ts:517")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"close"},"close"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"close"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,"Closes the current connection."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"connection.close().then(() => console.log('connection closed'));\n")),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L379"},"ottoman/ottoman.ts:379")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"connect"},"connect"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"connect"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"connectOptions"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">"),(0,r.kt)("p",null,"Connect to Couchbase server."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' import { connect } from "ottoman";\n const connection = connect("couchbase://localhost/travel-sample@admin:password");\n')),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"connectOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"ConnectOptions"))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">"),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L244"},"ottoman/ottoman.ts:244")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"dropbucket"},"dropBucket"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"dropBucket"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"bucketName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,"dropBucket drops a bucket from the cluster."),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"bucketName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DropBucketOptions"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L329"},"ottoman/ottoman.ts:329")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"dropcollection"},"dropCollection"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"dropCollection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collectionName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,"dropCollection drops a collection from a scope in a bucket."),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collectionName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DropCollectionOptions"))))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L299"},"ottoman/ottoman.ts:299")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"dropscope"},"dropScope"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"dropScope"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,"dropScope drops a scope from a bucket."),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DropScopeOptions"))))),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-25"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L316"},"ottoman/ottoman.ts:316")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"ensurecollections"},"ensureCollections"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"ensureCollections"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"ensureCollections")," will attempt to create scopes and collections to map your models to in Couchbase Server."),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-26"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L427"},"ottoman/ottoman.ts:427")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"ensureindexes"},"ensureIndexes"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"ensureIndexes"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," will attempt to create indexes defined in your schema if they do not exist."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"})),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"EnsureIndexesOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ignoreWatchIndexes"),": by default ",(0,r.kt)("inlineCode",{parentName:"td"},"ensureIndexes")," function will wait for indexes, but you can disabled it setting ignoreWatchIndexes to true.")))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-27"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L479"},"ottoman/ottoman.ts:479")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getcollection"},"getCollection"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getCollection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collectionName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Collection")),(0,r.kt)("p",null,"Return a collection from the given collectionName in this bucket\nor default collection if collectionName is missing."),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collectionName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DEFAULT_COLLECTION"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DEFAULT_SCOPE"))))),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Collection")),(0,r.kt)("h4",{id:"defined-in-28"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L353"},"ottoman/ottoman.ts:353")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getindexes"},"getIndexes"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getIndexes"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchIndex"),"[]",">"),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchIndex"),"[]",">"),(0,r.kt)("h4",{id:"defined-in-29"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L359"},"ottoman/ottoman.ts:359")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getmodel"},"getModel"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getModel"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Returns a Model constructor from the given model name."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const User = connection.getModel('User');\n")),(0,r.kt)("h4",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-30"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L345"},"ottoman/ottoman.ts:345")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"model"},"model"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"model"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Creates a Model on this connection."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const User = connection.model('User', { name: String }, { collectionName: 'users' });\n")),(0,r.kt)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-9"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"unknown"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/ModelOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelOptions")))))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"defined-in-31"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L262"},"ottoman/ottoman.ts:262")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"on"},"on"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"on"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"event"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"fn"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Register Ottoman events"),(0,r.kt)("h4",{id:"parameters-10"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"event")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},'"IndexOnline"')),(0,r.kt)("td",{parentName:"tr",align:"left"},"the name of the event you want to listen to.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fn")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"NodeCallback"),"<",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"callback function to be executed when the event trigger up.")))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-32"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L104"},"ottoman/ottoman.ts:104")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"query"},"query"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"query"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"TransactionQueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"QueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">",">"),(0,r.kt)("p",null,"Executes N1QL Queries."),(0,r.kt)("p",null,"Ottoman provides a powerful ",(0,r.kt)("a",{parentName:"p",href:"docs/basic/query-builder"},"Query Builder")," system to create valid N1QL queries using method chaining.\nSee the example below:"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const expr_where = {\n $or: [\n { address: { $like: '%57-59%' } },\n { free_breakfast: true }\n ]\n};\nconst query = new Query({}, 'travel-sample');\nconst n1qlQuery = query.select([{ $field: 'address' }])\n .where(expr_where)\n .build()\n\nconnection.query(n1qlQuery).then(result => console.log( result ))\n")),(0,r.kt)("p",null,"The above example will run this query:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample`\nWHERE (address LIKE '%57-59%' OR free_breakfast = true)\n")),(0,r.kt)("h4",{id:"parameters-11"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"QueryOptions")," & { ",(0,r.kt)("inlineCode",{parentName:"td"},"transactionContext?"),": ",(0,r.kt)("inlineCode",{parentName:"td"},"TransactionAttemptContext")," }")))),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"TransactionQueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"QueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">",">"),(0,r.kt)("h4",{id:"defined-in-33"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L417"},"ottoman/ottoman.ts:417")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"searchquery"},"searchQuery"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"searchQuery"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"indexName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"StreamableRowPromise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchResult"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchRow"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchMetaData"),">"),(0,r.kt)("h4",{id:"parameters-12"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"indexName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"SearchQuery"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"SearchQueryOptions"))))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"StreamableRowPromise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchResult"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchRow"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchMetaData"),">"),(0,r.kt)("h4",{id:"defined-in-34"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L363"},"ottoman/ottoman.ts:363")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"start"},"start"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"start"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"start")," method is just a shortcut to run ",(0,r.kt)("inlineCode",{parentName:"p"},"ensureCollections")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"ensureIndexes"),"."),(0,r.kt)("h4",{id:"parameters-13"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"StartOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ignoreWatchIndexes"),": by default ",(0,r.kt)("inlineCode",{parentName:"td"},"start")," function will wait for indexes, but you can disabled it setting ignoreWatchIndexes to true. Notice: It's not required to execute the ",(0,r.kt)("inlineCode",{parentName:"td"},"start")," method in order for Ottoman work.")))),(0,r.kt)("h4",{id:"returns-21"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-35"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L495"},"ottoman/ottoman.ts:495")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/df7f7ec8.7fd24fab.js b/assets/js/df7f7ec8.7fd24fab.js deleted file mode 100644 index b053bd14..00000000 --- a/assets/js/df7f7ec8.7fd24fab.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[1505],{3905:(e,t,n)=>{n.d(t,{Zo:()=>m,kt:()=>u});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},m=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},k=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,m=o(e,["components","mdxType","originalType","parentName"]),k=p(n),u=r,c=k["".concat(d,".").concat(u)]||k[u]||s[u]||l;return n?a.createElement(c,i(i({ref:t},m),{},{components:n})):a.createElement(c,i({ref:t},m))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=k;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>s,frontMatter:()=>l,metadata:()=>o,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const l={id:"Ottoman",title:"Class: Ottoman",sidebar_label:"Ottoman",sidebar_position:0,custom_edit_url:null},i=void 0,o={unversionedId:"api/classes/Ottoman",id:"api/classes/Ottoman",title:"Class: Ottoman",description:"Constructors",source:"@site/docs/api/classes/Ottoman.md",sourceDirName:"api/classes",slug:"/api/classes/Ottoman",permalink:"/docs/api/classes/Ottoman",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Ottoman",title:"Class: Ottoman",sidebar_label:"Ottoman",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"NumberType",permalink:"/docs/api/classes/NumberType"},next:{title:"Query",permalink:"/docs/api/classes/Query"}},d={},p=[{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"_cluster",id:"_cluster",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"bucket",id:"bucket",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"bucketName",id:"bucketname",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"config",id:"config",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"couchbase",id:"couchbase",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"events",id:"events",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"id",id:"id",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"indexOnline",id:"indexonline",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"indexOnlinePromise",id:"indexonlinepromise",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"models",id:"models",level:3},{value:"Defined in",id:"defined-in-10",level:4},{value:"n1qlIndexes",id:"n1qlindexes",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"refdocIndexes",id:"refdocindexes",level:3},{value:"Defined in",id:"defined-in-12",level:4},{value:"viewIndexes",id:"viewindexes",level:3},{value:"Defined in",id:"defined-in-13",level:4},{value:"Accessors",id:"accessors",level:2},{value:"bucketManager",id:"bucketmanager",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"cluster",id:"cluster",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"collectionManager",id:"collectionmanager",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"indexReadyHooks",id:"indexreadyhooks",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"queryIndexManager",id:"queryindexmanager",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"viewIndexManager",id:"viewindexmanager",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-19",level:4},{value:"Methods",id:"methods",level:2},{value:"close",id:"close",level:3},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"connect",id:"connect",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"dropBucket",id:"dropbucket",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"dropCollection",id:"dropcollection",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"dropScope",id:"dropscope",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-24",level:4},{value:"ensureCollections",id:"ensurecollections",level:3},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-25",level:4},{value:"ensureIndexes",id:"ensureindexes",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-26",level:4},{value:"getCollection",id:"getcollection",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Defined in",id:"defined-in-27",level:4},{value:"getIndexes",id:"getindexes",level:3},{value:"Returns",id:"returns-14",level:4},{value:"Defined in",id:"defined-in-28",level:4},{value:"getModel",id:"getmodel",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-15",level:4},{value:"Defined in",id:"defined-in-29",level:4},{value:"model",id:"model",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-16",level:4},{value:"Defined in",id:"defined-in-30",level:4},{value:"on",id:"on",level:3},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Defined in",id:"defined-in-31",level:4},{value:"query",id:"query",level:3},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Defined in",id:"defined-in-32",level:4},{value:"searchQuery",id:"searchquery",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-19",level:4},{value:"Defined in",id:"defined-in-33",level:4},{value:"start",id:"start",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Defined in",id:"defined-in-34",level:4}],m={toc:p};function s(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},m,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new Ottoman"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"config?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"config")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"OttomanConfig"))))),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L221"},"ottoman/ottoman.ts:221")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"_cluster"},"_","cluster"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"_","cluster"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Cluster")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L202"},"ottoman/ottoman.ts:202")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"bucket"},"bucket"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"bucket"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Bucket")),(0,r.kt)("p",null,"Bucket represents a storage grouping of data within a Couchbase Server cluster."),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L150"},"ottoman/ottoman.ts:150")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"bucketname"},"bucketName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"bucketName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"''")),(0,r.kt)("p",null,"Contains the name of the current bucket."),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L214"},"ottoman/ottoman.ts:214")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"config"},"config"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"config"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"OttomanConfig")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L145"},"ottoman/ottoman.ts:145")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"couchbase"},"couchbase"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"couchbase"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Stores a reference to couchbase instance."),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L219"},"ottoman/ottoman.ts:219")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"events"},"events"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"events"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},'"IndexOnline"'),", ",(0,r.kt)("inlineCode",{parentName:"p"},"NodeCallback"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">","[]",">"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L84"},"ottoman/ottoman.ts:84")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"id"},"id"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Readonly")," ",(0,r.kt)("strong",{parentName:"p"},"id"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L83"},"ottoman/ottoman.ts:83")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexonline"},"indexOnline"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"indexOnline"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Error")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"false")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L87"},"ottoman/ottoman.ts:87")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexonlinepromise"},"indexOnlinePromise"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"indexOnlinePromise"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L88"},"ottoman/ottoman.ts:88")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"models"},"models"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"models"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Object")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")),(0,r.kt)("p",null,"Dictionary for all models registered on this connection."),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L200"},"ottoman/ottoman.ts:200")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"n1qlindexes"},"n1qlIndexes"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"n1qlIndexes"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", { ",(0,r.kt)("inlineCode",{parentName:"p"},"fields"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[] ; ",(0,r.kt)("inlineCode",{parentName:"p"},"modelName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," }",">"," = ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L80"},"ottoman/ottoman.ts:80")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"refdocindexes"},"refdocIndexes"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"refdocIndexes"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", { ",(0,r.kt)("inlineCode",{parentName:"p"},"fields"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[] }[]",">"," = ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L82"},"ottoman/ottoman.ts:82")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"viewindexes"},"viewIndexes"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"viewIndexes"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", { ",(0,r.kt)("inlineCode",{parentName:"p"},"views"),": { ",(0,r.kt)("inlineCode",{parentName:"p"},"map?"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," } }",">"," = ",(0,r.kt)("inlineCode",{parentName:"p"},"{}")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L81"},"ottoman/ottoman.ts:81")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"bucketmanager"},"bucketManager"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"bucketManager"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"BucketManager")),(0,r.kt)("p",null,"Gets a bucket manager for this cluster."),(0,r.kt)("p",null,"Check the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/BucketManager.html"},"Bucket Manager Couchbase SDK API"),"\ndocumentation for more details."),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"BucketManager")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L170"},"ottoman/ottoman.ts:170")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cluster"},"cluster"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"cluster"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Cluster")),(0,r.kt)("p",null,"Cluster represents an entire Couchbase Server cluster."),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Cluster")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L207"},"ottoman/ottoman.ts:207")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"collectionmanager"},"collectionManager"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"collectionManager"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"CollectionManager")),(0,r.kt)("p",null,"CollectionManager allows the management of collections within a Bucket."),(0,r.kt)("p",null,"Check the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/CollectionManager.html"},"Collection Manager Couchbase SDK API"),"\ndocumentation for more details."),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"CollectionManager")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L159"},"ottoman/ottoman.ts:159")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexreadyhooks"},"indexReadyHooks"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"indexReadyHooks"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"NodeCallback"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">","[]"),(0,r.kt)("p",null,'Retrieve all register callbacks to "IndexOnline" event'),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"NodeCallback"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">","[]"),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L93"},"ottoman/ottoman.ts:93")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"queryindexmanager"},"queryIndexManager"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"queryIndexManager"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"QueryIndexManager")),(0,r.kt)("p",null,"QueryIndexManager provides an interface for managing the query indexes on the cluster."),(0,r.kt)("p",null,"Check the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/QueryIndexManager.html"},"Query Index Manager Couchbase SDK API"),"\ndocumentation for more details."),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"QueryIndexManager")),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L181"},"ottoman/ottoman.ts:181")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"viewindexmanager"},"viewIndexManager"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"viewIndexManager"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"ViewIndexManager")),(0,r.kt)("p",null,"ViewIndexManager is an interface which enables the management of view indexes on the cluster."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Deprecated"))),(0,r.kt)("p",null,"Check the\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/ViewIndexManager.html"},"View Index Manager Couchbase SDK API"),"\ndocumentation for more details."),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"ViewIndexManager")),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L193"},"ottoman/ottoman.ts:193")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"close"},"close"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"close"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,"Closes the current connection."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"connection.close().then(() => console.log('connection closed'));\n")),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L377"},"ottoman/ottoman.ts:377")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"connect"},"connect"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"connect"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"connectOptions"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">"),(0,r.kt)("p",null,"Connect to Couchbase server."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},' import { connect } from "ottoman";\n const connection = connect("couchbase://localhost/travel-sample@admin:password");\n')),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"connectOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"ConnectOptions"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">"),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L242"},"ottoman/ottoman.ts:242")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"dropbucket"},"dropBucket"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"dropBucket"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"bucketName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,"dropBucket drops a bucket from the cluster."),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"bucketName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DropBucketOptions"))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L327"},"ottoman/ottoman.ts:327")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"dropcollection"},"dropCollection"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"dropCollection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collectionName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,"dropCollection drops a collection from a scope in a bucket."),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collectionName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DropCollectionOptions"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L297"},"ottoman/ottoman.ts:297")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"dropscope"},"dropScope"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"dropScope"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,"dropScope drops a scope from a bucket."),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DropScopeOptions"))))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L314"},"ottoman/ottoman.ts:314")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"ensurecollections"},"ensureCollections"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"ensureCollections"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"ensureCollections")," will attempt to create scopes and collections to map your models to in Couchbase Server."),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-25"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L422"},"ottoman/ottoman.ts:422")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"ensureindexes"},"ensureIndexes"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"ensureIndexes"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"ensureIndexes")," will attempt to create indexes defined in your schema if they do not exist."),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"})),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"EnsureIndexesOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ignoreWatchIndexes"),": by default ",(0,r.kt)("inlineCode",{parentName:"td"},"ensureIndexes")," function will wait for indexes, but you can disabled it setting ignoreWatchIndexes to true.")))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-26"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L474"},"ottoman/ottoman.ts:474")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getcollection"},"getCollection"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getCollection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collectionName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Collection")),(0,r.kt)("p",null,"Return a collection from the given collectionName in this bucket\nor default collection if collectionName is missing."),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collectionName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DEFAULT_COLLECTION"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DEFAULT_SCOPE"))))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Collection")),(0,r.kt)("h4",{id:"defined-in-27"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L351"},"ottoman/ottoman.ts:351")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getindexes"},"getIndexes"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getIndexes"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchIndex"),"[]",">"),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchIndex"),"[]",">"),(0,r.kt)("h4",{id:"defined-in-28"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L357"},"ottoman/ottoman.ts:357")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getmodel"},"getModel"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getModel"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Returns a Model constructor from the given model name."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const User = connection.getModel('User');\n")),(0,r.kt)("h4",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-29"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L343"},"ottoman/ottoman.ts:343")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"model"},"model"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"model"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("p",null,"Creates a Model on this connection."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const User = connection.model('User', { name: String }, { collectionName: 'users' });\n")),(0,r.kt)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"unknown"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/ModelOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelOptions")))))),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"defined-in-30"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L260"},"ottoman/ottoman.ts:260")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"on"},"on"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"on"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"event"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"fn"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Register Ottoman events"),(0,r.kt)("h4",{id:"parameters-9"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"event")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},'"IndexOnline"')),(0,r.kt)("td",{parentName:"tr",align:"left"},"the name of the event you want to listen to.")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fn")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"NodeCallback"),"<",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"callback function to be executed when the event trigger up.")))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-31"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L102"},"ottoman/ottoman.ts:102")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"query"},"query"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"query"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"QueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">",">"),(0,r.kt)("p",null,"Executes N1QL Queries."),(0,r.kt)("p",null,"Ottoman provides a powerful ",(0,r.kt)("a",{parentName:"p",href:"docs/basic/query-builder"},"Query Builder")," system to create valid N1QL queries using method chaining.\nSee the example below:"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-js"},"const expr_where = {\n $or: [\n { address: { $like: '%57-59%' } },\n { free_breakfast: true }\n ]\n};\nconst query = new Query({}, 'travel-sample');\nconst n1qlQuery = query.select([{ $field: 'address' }])\n .where(expr_where)\n .build()\n\nconnection.query(n1qlQuery).then(result => console.log( result ))\n")),(0,r.kt)("p",null,"The above example will run this query:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample`\nWHERE (address LIKE '%57-59%' OR free_breakfast = true)\n")),(0,r.kt)("h4",{id:"parameters-10"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"QueryOptions"))))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"QueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">",">"),(0,r.kt)("h4",{id:"defined-in-32"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L415"},"ottoman/ottoman.ts:415")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"searchquery"},"searchQuery"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"searchQuery"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"indexName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"StreamableRowPromise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchResult"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchRow"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchMetaData"),">"),(0,r.kt)("h4",{id:"parameters-11"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"indexName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"SearchQuery"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"SearchQueryOptions"))))),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"StreamableRowPromise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchResult"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchRow"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchMetaData"),">"),(0,r.kt)("h4",{id:"defined-in-33"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L361"},"ottoman/ottoman.ts:361")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"start"},"start"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"start"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"start")," method is just a shortcut to run ",(0,r.kt)("inlineCode",{parentName:"p"},"ensureCollections")," and ",(0,r.kt)("inlineCode",{parentName:"p"},"ensureIndexes"),"."),(0,r.kt)("h4",{id:"parameters-12"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"StartOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ignoreWatchIndexes"),": by default ",(0,r.kt)("inlineCode",{parentName:"td"},"start")," function will wait for indexes, but you can disabled it setting ignoreWatchIndexes to true. Notice: It's not required to execute the ",(0,r.kt)("inlineCode",{parentName:"td"},"start")," method in order for Ottoman work.")))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-34"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L490"},"ottoman/ottoman.ts:490")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/e2447885.9eded184.js b/assets/js/e2447885.a0c85161.js similarity index 94% rename from assets/js/e2447885.9eded184.js rename to assets/js/e2447885.a0c85161.js index d9b5fc96..6266ea1e 100644 --- a/assets/js/e2447885.9eded184.js +++ b/assets/js/e2447885.a0c85161.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[1295],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),o=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=o(e.components);return a.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=o(n),k=r,c=u["".concat(d,".").concat(k)]||u[k]||m[k]||i;return n?a.createElement(c,l(l({ref:t},s),{},{components:n})):a.createElement(c,l({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=u;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var a=n(7462),r=(n(7294),n(3905));const i={id:"NumberType",title:"Class: NumberType",sidebar_label:"NumberType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/NumberType",id:"api/classes/NumberType",title:"Class: NumberType",description:"Number are plain JavaScript Number.",source:"@site/docs/api/classes/NumberType.md",sourceDirName:"api/classes",slug:"/api/classes/NumberType",permalink:"/docs/api/classes/NumberType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"NumberType",title:"Class: NumberType",sidebar_label:"NumberType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"MultipleQueryTypesException",permalink:"/docs/api/classes/MultipleQueryTypesException"},next:{title:"Ottoman",permalink:"/docs/api/classes/Ottoman"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"intVal",id:"intval",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"max",id:"max",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"min",id:"min",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"Methods",id:"methods",level:2},{value:"_checkMax",id:"_checkmax",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"_checkMin",id:"_checkmin",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-10",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-14",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-19",level:4}],s={toc:o};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Number")," are plain JavaScript Number."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"intVal")," flag that will allow only integer values"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"min")," minimum numerical value value that will be accepted"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"max")," maximum numeric value that will be accepted")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const userSchema = new Schema({\n age: Number,\n})\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"NumberType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new NumberType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions")," & ",(0,r.kt)("inlineCode",{parentName:"td"},"NumberTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/number-type.ts#L40"},"schema/types/number-type.ts:40")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"Number.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/number-type.ts#L43"},"schema/types/number-type.ts:43")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"intval"},"intVal"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"intVal"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/number-type.ts#L55"},"schema/types/number-type.ts:55")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"max"},"max"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"max"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"NumberFunction")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"MinmaxOption")),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"NumberFunction")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"MinmaxOption")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/number-type.ts#L45"},"schema/types/number-type.ts:45")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"min"},"min"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"min"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"NumberFunction")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"MinmaxOption")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"NumberFunction")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"MinmaxOption")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/number-type.ts#L50"},"schema/types/number-type.ts:50")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_checkmax"},"_","checkMax"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMax"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/number-type.ts#L97"},"schema/types/number-type.ts:97")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkmin"},"_","checkMin"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMin"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/number-type.ts#L92"},"schema/types/number-type.ts:92")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/number-type.ts#L60"},"schema/types/number-type.ts:60")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/number-type.ts#L69"},"schema/types/number-type.ts:69")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[1295],{3905:(e,t,n)=>{n.d(t,{Zo:()=>s,kt:()=>k});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),o=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},s=function(e){var t=o(e.components);return a.createElement(d.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},u=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,s=p(e,["components","mdxType","originalType","parentName"]),u=o(n),k=r,c=u["".concat(d,".").concat(k)]||u[k]||m[k]||i;return n?a.createElement(c,l(l({ref:t},s),{},{components:n})):a.createElement(c,l({ref:t},s))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=u;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,l[1]=p;for(var o=2;o{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>i,metadata:()=>p,toc:()=>o});var a=n(7462),r=(n(7294),n(3905));const i={id:"NumberType",title:"Class: NumberType",sidebar_label:"NumberType",sidebar_position:0,custom_edit_url:null},l=void 0,p={unversionedId:"api/classes/NumberType",id:"api/classes/NumberType",title:"Class: NumberType",description:"Number are plain JavaScript Number.",source:"@site/docs/api/classes/NumberType.md",sourceDirName:"api/classes",slug:"/api/classes/NumberType",permalink:"/docs/api/classes/NumberType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"NumberType",title:"Class: NumberType",sidebar_label:"NumberType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"MultipleQueryTypesException",permalink:"/docs/api/classes/MultipleQueryTypesException"},next:{title:"Ottoman",permalink:"/docs/api/classes/Ottoman"}},d={},o=[{value:"Options",id:"options",level:2},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"intVal",id:"intval",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"max",id:"max",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"min",id:"min",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-4",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"Methods",id:"methods",level:2},{value:"_checkMax",id:"_checkmax",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"_checkMin",id:"_checkmin",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-10",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Inherited from",id:"inherited-from-10",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-14",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-19",level:4}],s={toc:o};function m(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},s,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Number")," are plain JavaScript Number."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"intVal")," flag that will allow only integer values"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"min")," minimum numerical value value that will be accepted"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"max")," maximum numeric value that will be accepted")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const userSchema = new Schema({\n age: Number,\n})\n")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"NumberType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new NumberType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions")," & ",(0,r.kt)("inlineCode",{parentName:"td"},"NumberTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/number-type.ts#L40"},"schema/types/number-type.ts:40")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"Number.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/number-type.ts#L43"},"schema/types/number-type.ts:43")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"intval"},"intVal"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"intVal"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/number-type.ts#L55"},"schema/types/number-type.ts:55")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"max"},"max"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"max"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"NumberFunction")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"MinmaxOption")),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"NumberFunction")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"MinmaxOption")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/number-type.ts#L45"},"schema/types/number-type.ts:45")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"min"},"min"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"min"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"NumberFunction")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"MinmaxOption")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"NumberFunction")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"MinmaxOption")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/number-type.ts#L50"},"schema/types/number-type.ts:50")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"_checkmax"},"_","checkMax"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMax"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/number-type.ts#L97"},"schema/types/number-type.ts:97")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_checkmin"},"_","checkMin"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("strong",{parentName:"p"},"_checkMin"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/number-type.ts#L92"},"schema/types/number-type.ts:92")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/number-type.ts#L60"},"schema/types/number-type.ts:60")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L75"},"schema/types/core-type.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-10"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/number-type.ts#L69"},"schema/types/number-type.ts:69")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/edaeaefb.4ac6931a.js b/assets/js/edaeaefb.314972f1.js similarity index 95% rename from assets/js/edaeaefb.4ac6931a.js rename to assets/js/edaeaefb.314972f1.js index 522e213f..7304c689 100644 --- a/assets/js/edaeaefb.4ac6931a.js +++ b/assets/js/edaeaefb.314972f1.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9309],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),d=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},s=function(e){var t=d(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=d(a),k=r,c=u["".concat(p,".").concat(k)]||u[k]||m[k]||l;return a?n.createElement(c,i(i({ref:t},s),{},{components:a})):n.createElement(c,i({ref:t},s))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var d=2;d{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var n=a(7462),r=(a(7294),a(3905));const l={id:"BooleanType",title:"Class: BooleanType",sidebar_label:"BooleanType",sidebar_position:0,custom_edit_url:null},i=void 0,o={unversionedId:"api/classes/BooleanType",id:"api/classes/BooleanType",title:"Class: BooleanType",description:"Boolean are plain JavaScript Boolean.",source:"@site/docs/api/classes/BooleanType.md",sourceDirName:"api/classes",slug:"/api/classes/BooleanType",permalink:"/docs/api/classes/BooleanType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"BooleanType",title:"Class: BooleanType",sidebar_label:"BooleanType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ArrayType",permalink:"/docs/api/classes/ArrayType"},next:{title:"BuildSchemaError",permalink:"/docs/api/classes/BuildSchemaError"}},p={},d=[{value:"Options",id:"options",level:2},{value:"Ottoman will cast the following values to true:",id:"ottoman-will-cast-the-following-values-to-true",level:3},{value:"Ottoman will cast the following values to false:",id:"ottoman-will-cast-the-following-values-to-false",level:3},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"convertToFalse",id:"converttofalse",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"convertToTrue",id:"converttotrue",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-4",level:4},{value:"Defined in",id:"defined-in-16",level:4}],s={toc:d};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Boolean")," are plain JavaScript Boolean."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const userSchema = new Schema({\n isActive: Boolean,\n isSomething: Schema.Types.Boolean\n})\n")),(0,r.kt)("h3",{id:"ottoman-will-cast-the-following-values-to-true"},"Ottoman will cast the following values to true:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"true"),(0,r.kt)("li",{parentName:"ul"},"'true'"),(0,r.kt)("li",{parentName:"ul"},"1"),(0,r.kt)("li",{parentName:"ul"},"'1'"),(0,r.kt)("li",{parentName:"ul"},"'yes'")),(0,r.kt)("h3",{id:"ottoman-will-cast-the-following-values-to-false"},"Ottoman will cast the following values to false:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"false"),(0,r.kt)("li",{parentName:"ul"},"'false'"),(0,r.kt)("li",{parentName:"ul"},"0"),(0,r.kt)("li",{parentName:"ul"},"'0'"),(0,r.kt)("li",{parentName:"ul"},"'no'")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"BooleanType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new BooleanType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/boolean-type.ts#L39"},"schema/types/boolean-type.ts:39")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"converttofalse"},"convertToFalse"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"convertToFalse"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Set"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean"),">"),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/boolean-type.ts#L45"},"schema/types/boolean-type.ts:45")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"converttotrue"},"convertToTrue"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"convertToTrue"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Set"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean"),">"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/boolean-type.ts#L44"},"schema/types/boolean-type.ts:44")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"Boolean.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/boolean-type.ts#L42"},"schema/types/boolean-type.ts:42")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/boolean-type.ts#L47"},"schema/types/boolean-type.ts:47")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/boolean-type.ts#L65"},"schema/types/boolean-type.ts:65")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-4"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/types/boolean-type.ts#L57"},"schema/types/boolean-type.ts:57")))}m.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[9309],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var p=n.createContext({}),d=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},s=function(e){var t=d(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),u=d(a),k=r,c=u["".concat(p,".").concat(k)]||u[k]||m[k]||l;return a?n.createElement(c,i(i({ref:t},s),{},{components:a})):n.createElement(c,i({ref:t},s))}));function k(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=u;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:r,i[1]=o;for(var d=2;d{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>i,default:()=>m,frontMatter:()=>l,metadata:()=>o,toc:()=>d});var n=a(7462),r=(a(7294),a(3905));const l={id:"BooleanType",title:"Class: BooleanType",sidebar_label:"BooleanType",sidebar_position:0,custom_edit_url:null},i=void 0,o={unversionedId:"api/classes/BooleanType",id:"api/classes/BooleanType",title:"Class: BooleanType",description:"Boolean are plain JavaScript Boolean.",source:"@site/docs/api/classes/BooleanType.md",sourceDirName:"api/classes",slug:"/api/classes/BooleanType",permalink:"/docs/api/classes/BooleanType",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"BooleanType",title:"Class: BooleanType",sidebar_label:"BooleanType",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"ArrayType",permalink:"/docs/api/classes/ArrayType"},next:{title:"BuildSchemaError",permalink:"/docs/api/classes/BuildSchemaError"}},p={},d=[{value:"Options",id:"options",level:2},{value:"Ottoman will cast the following values to true:",id:"ottoman-will-cast-the-following-values-to-true",level:3},{value:"Ottoman will cast the following values to false:",id:"ottoman-will-cast-the-following-values-to-false",level:3},{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"name",id:"name",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"options",id:"options-1",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"typeName",id:"typename",level:3},{value:"Inherited from",id:"inherited-from-2",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"convertToFalse",id:"converttofalse",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"convertToTrue",id:"converttotrue",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"sName",id:"sname",level:3},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"Accessors",id:"accessors",level:2},{value:"default",id:"default",level:3},{value:"Returns",id:"returns",level:4},{value:"Inherited from",id:"inherited-from-3",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"required",id:"required",level:3},{value:"Returns",id:"returns-1",level:4},{value:"Inherited from",id:"inherited-from-4",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"validator",id:"validator",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Inherited from",id:"inherited-from-5",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"Methods",id:"methods",level:2},{value:"buildDefault",id:"builddefault",level:3},{value:"Returns",id:"returns-3",level:4},{value:"Inherited from",id:"inherited-from-6",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"cast",id:"cast",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"checkRequired",id:"checkrequired",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Inherited from",id:"inherited-from-7",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"checkValidator",id:"checkvalidator",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Inherited from",id:"inherited-from-8",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"isEmpty",id:"isempty",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"isStrictStrategy",id:"isstrictstrategy",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Inherited from",id:"inherited-from-9",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Overrides",id:"overrides-4",level:4},{value:"Defined in",id:"defined-in-16",level:4}],s={toc:d};function m(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Boolean")," are plain JavaScript Boolean."),(0,r.kt)("h2",{id:"options"},"Options"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"required")," flag to define if the field is mandatory"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"validator")," that will be applied to the field a validation function, validation object or string with the name of the custom validator"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"default")," that will define the initial value of the field, this option allows a value or a function"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("strong",{parentName:"li"},"immutable")," that will define this field as immutable. Ottoman prevents you from changing immutable fields if the schema as configure like strict")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const userSchema = new Schema({\n isActive: Boolean,\n isSomething: Schema.Types.Boolean\n})\n")),(0,r.kt)("h3",{id:"ottoman-will-cast-the-following-values-to-true"},"Ottoman will cast the following values to true:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"true"),(0,r.kt)("li",{parentName:"ul"},"'true'"),(0,r.kt)("li",{parentName:"ul"},"1"),(0,r.kt)("li",{parentName:"ul"},"'1'"),(0,r.kt)("li",{parentName:"ul"},"'yes'")),(0,r.kt)("h3",{id:"ottoman-will-cast-the-following-values-to-false"},"Ottoman will cast the following values to false:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"false"),(0,r.kt)("li",{parentName:"ul"},"'false'"),(0,r.kt)("li",{parentName:"ul"},"0"),(0,r.kt)("li",{parentName:"ul"},"'0'"),(0,r.kt)("li",{parentName:"ul"},"'no'")),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},(0,r.kt)("inlineCode",{parentName:"a"},"CoreType"))),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"BooleanType"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new BooleanType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CoreTypeOptions"))))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#constructor"},"constructor")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/boolean-type.ts#L39"},"schema/types/boolean-type.ts:39")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"name"},"name"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"name"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#name"},"name")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"options-1"},"options"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"options"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CoreTypeOptions")),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#options"},"options")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L23"},"schema/types/core-type.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"typename"},"typeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"typeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from-2"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#typename"},"typeName")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L51"},"schema/interfaces/schema.types.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"converttofalse"},"convertToFalse"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"convertToFalse"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Set"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean"),">"),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/boolean-type.ts#L45"},"schema/types/boolean-type.ts:45")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"converttotrue"},"convertToTrue"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"convertToTrue"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Set"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean"),">"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/boolean-type.ts#L44"},"schema/types/boolean-type.ts:44")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sname"},"sName"),(0,r.kt)("p",null,"\u25aa ",(0,r.kt)("inlineCode",{parentName:"p"},"Static")," ",(0,r.kt)("strong",{parentName:"p"},"sName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," = ",(0,r.kt)("inlineCode",{parentName:"p"},"Boolean.name")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#sname"},"sName")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/boolean-type.ts#L42"},"schema/types/boolean-type.ts:42")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"default"},"default"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"default"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-3"},"Inherited from"),(0,r.kt)("p",null,"CoreType.default"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L39"},"schema/types/core-type.ts:39")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"required"},"required"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"required"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredOption")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"RequiredFunction")),(0,r.kt)("h4",{id:"inherited-from-4"},"Inherited from"),(0,r.kt)("p",null,"CoreType.required"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L31"},"schema/types/core-type.ts:31")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validator"},"validator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"validator"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ValidatorFunction")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/ValidatorOption"},(0,r.kt)("inlineCode",{parentName:"a"},"ValidatorOption"))),(0,r.kt)("h4",{id:"inherited-from-5"},"Inherited from"),(0,r.kt)("p",null,"CoreType.validator"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L35"},"schema/types/core-type.ts:35")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"builddefault"},"buildDefault"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildDefault"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"unknown")),(0,r.kt)("h4",{id:"inherited-from-6"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#builddefault"},"buildDefault")),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L43"},"schema/types/core-type.ts:43")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"cast"},"cast"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"cast"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CAST_STRATEGY.DEFAULT_OR_DROP"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-2"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#cast"},"cast")),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/boolean-type.ts#L47"},"schema/types/boolean-type.ts:47")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkrequired"},"checkRequired"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkRequired"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-7"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkrequired"},"checkRequired")),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L62"},"schema/types/core-type.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"checkvalidator"},"checkValidator"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"checkValidator"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"unknown"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"inherited-from-8"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#checkvalidator"},"checkValidator")),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L71"},"schema/types/core-type.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isempty"},"isEmpty"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isEmpty"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"overrides-3"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isempty"},"isEmpty")),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/boolean-type.ts#L65"},"schema/types/boolean-type.ts:65")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isstrictstrategy"},"isStrictStrategy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isStrictStrategy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/enums/VALIDATION_STRATEGY"},(0,r.kt)("inlineCode",{parentName:"a"},"VALIDATION_STRATEGY")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"inherited-from-9"},"Inherited from"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#isstrictstrategy"},"isStrictStrategy")),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/core-type.ts#L79"},"schema/types/core-type.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"strategy"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strategy")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"overrides-4"},"Overrides"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType"},"CoreType"),".",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/CoreType#validate"},"validate")),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/types/boolean-type.ts#L57"},"schema/types/boolean-type.ts:57")))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f3182975.d480f580.js b/assets/js/f3182975.b7634b44.js similarity index 96% rename from assets/js/f3182975.d480f580.js rename to assets/js/f3182975.b7634b44.js index e747b9a4..6bd43e45 100644 --- a/assets/js/f3182975.d480f580.js +++ b/assets/js/f3182975.b7634b44.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7679],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(n),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||i;return n?r.createElement(m,o(o({ref:t},c),{},{components:n})):r.createElement(m,o({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(7462),a=(n(7294),n(3905));const i={id:"IIndexWithParams",title:"Interface: IIndexWithParams",sidebar_label:"IIndexWithParams",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/interfaces/IIndexWithParams",id:"api/interfaces/IIndexWithParams",title:"Interface: IIndexWithParams",description:"Index WITH clause",source:"@site/docs/api/interfaces/IIndexWithParams.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IIndexWithParams",permalink:"/docs/api/interfaces/IIndexWithParams",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IIndexWithParams",title:"Interface: IIndexWithParams",sidebar_label:"IIndexWithParams",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IIndexOnParams",permalink:"/docs/api/interfaces/IIndexOnParams"},next:{title:"IManyQueryResponse",permalink:"/docs/api/interfaces/IManyQueryResponse"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:"defer_build",id:"defer_build",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"nodes",id:"nodes",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"num_replica",id:"num_replica",level:3},{value:"Defined in",id:"defined-in-2",level:4}],c={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Index WITH clause"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"defer_build"},"defer","_","build"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"defer","_","build"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L292"},"query/interface/query.types.ts:292")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"nodes"},"nodes"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"nodes"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L291"},"query/interface/query.types.ts:291")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"num_replica"},"num","_","replica"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"num","_","replica"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L293"},"query/interface/query.types.ts:293")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7679],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var r=n(7294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function o(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var p=r.createContext({}),s=function(e){var t=r.useContext(p),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},c=function(e){var t=s(e.components);return r.createElement(p.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return r.createElement(r.Fragment,{},t)}},u=r.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,p=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=s(n),f=a,m=u["".concat(p,".").concat(f)]||u[f]||d[f]||i;return n?r.createElement(m,o(o({ref:t},c),{},{components:n})):r.createElement(m,o({ref:t},c))}));function f(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,o=new Array(i);o[0]=u;var l={};for(var p in t)hasOwnProperty.call(t,p)&&(l[p]=t[p]);l.originalType=e,l.mdxType="string"==typeof e?e:a,o[1]=l;for(var s=2;s{n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>s});var r=n(7462),a=(n(7294),n(3905));const i={id:"IIndexWithParams",title:"Interface: IIndexWithParams",sidebar_label:"IIndexWithParams",sidebar_position:0,custom_edit_url:null},o=void 0,l={unversionedId:"api/interfaces/IIndexWithParams",id:"api/interfaces/IIndexWithParams",title:"Interface: IIndexWithParams",description:"Index WITH clause",source:"@site/docs/api/interfaces/IIndexWithParams.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IIndexWithParams",permalink:"/docs/api/interfaces/IIndexWithParams",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IIndexWithParams",title:"Interface: IIndexWithParams",sidebar_label:"IIndexWithParams",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IIndexOnParams",permalink:"/docs/api/interfaces/IIndexOnParams"},next:{title:"IManyQueryResponse",permalink:"/docs/api/interfaces/IManyQueryResponse"}},p={},s=[{value:"Properties",id:"properties",level:2},{value:"defer_build",id:"defer_build",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"nodes",id:"nodes",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"num_replica",id:"num_replica",level:3},{value:"Defined in",id:"defined-in-2",level:4}],c={toc:s};function d(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,r.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("p",null,"Index WITH clause"),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"defer_build"},"defer","_","build"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"defer","_","build"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"boolean")),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L292"},"query/interface/query.types.ts:292")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"nodes"},"nodes"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"nodes"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L291"},"query/interface/query.types.ts:291")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"num_replica"},"num","_","replica"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,a.kt)("strong",{parentName:"p"},"num","_","replica"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"number")),(0,a.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L293"},"query/interface/query.types.ts:293")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f45ac2d9.652fe37c.js b/assets/js/f45ac2d9.652fe37c.js deleted file mode 100644 index b8801f93..00000000 --- a/assets/js/f45ac2d9.652fe37c.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[367],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>N});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),k=o(a),N=r,u=k["".concat(d,".").concat(N)]||k[N]||s[N]||l;return a?n.createElement(u,i(i({ref:t},m),{},{components:a})):n.createElement(u,i({ref:t},m))}));function N(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>s,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const l={id:"IModel",title:"Interface: IModel",sidebar_label:"IModel",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/interfaces/IModel",id:"api/interfaces/IModel",title:"Interface: IModel",description:"Constructor to build a model instance based on schema and options.",source:"@site/docs/api/interfaces/IModel.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IModel",permalink:"/docs/api/interfaces/IModel",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IModel",title:"Interface: IModel",sidebar_label:"IModel",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IManyQueryResponse",permalink:"/docs/api/interfaces/IManyQueryResponse"},next:{title:"IStatusExecution",permalink:"/docs/api/interfaces/IStatusExecution"}},d={},o=[{value:"Type parameters",id:"type-parameters",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"namespace",id:"namespace",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"Methods",id:"methods",level:2},{value:"count",id:"count",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"create",id:"create",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"createMany",id:"createmany",level:3},{value:"Type parameters",id:"type-parameters-2",level:4},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"dropCollection",id:"dropcollection",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"find",id:"find",level:3},{value:"Type parameters",id:"type-parameters-3",level:4},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"findById",id:"findbyid",level:3},{value:"Type parameters",id:"type-parameters-4",level:4},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"Type parameters",id:"type-parameters-5",level:4},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"findOne",id:"findone",level:3},{value:"Type parameters",id:"type-parameters-6",level:4},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"Type parameters",id:"type-parameters-7",level:4},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"findOneAndRemove",id:"findoneandremove",level:3},{value:"Type parameters",id:"type-parameters-8",level:4},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"Type parameters",id:"type-parameters-9",level:4},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"findOneAndUpdate",id:"findoneandupdate",level:3},{value:"Type parameters",id:"type-parameters-10",level:4},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"Type parameters",id:"type-parameters-11",level:4},{value:"Parameters",id:"parameters-13",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"fromData",id:"fromdata",level:3},{value:"Parameters",id:"parameters-14",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"query",id:"query",level:3},{value:"Parameters",id:"parameters-15",level:4},{value:"Returns",id:"returns-14",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"removeById",id:"removebyid",level:3},{value:"Parameters",id:"parameters-16",level:4},{value:"Returns",id:"returns-15",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"removeMany",id:"removemany",level:3},{value:"Type parameters",id:"type-parameters-12",level:4},{value:"Parameters",id:"parameters-17",level:4},{value:"Returns",id:"returns-16",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"replaceById",id:"replacebyid",level:3},{value:"Type parameters",id:"type-parameters-13",level:4},{value:"Parameters",id:"parameters-18",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Defined in",id:"defined-in-19",level:4},{value:"Type parameters",id:"type-parameters-14",level:4},{value:"Parameters",id:"parameters-19",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"updateById",id:"updatebyid",level:3},{value:"Type parameters",id:"type-parameters-15",level:4},{value:"Parameters",id:"parameters-20",level:4},{value:"Returns",id:"returns-19",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"Type parameters",id:"type-parameters-16",level:4},{value:"Parameters",id:"parameters-21",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"updateMany",id:"updatemany",level:3},{value:"Type parameters",id:"type-parameters-17",level:4},{value:"Parameters",id:"parameters-22",level:4},{value:"Returns",id:"returns-21",level:4},{value:"Defined in",id:"defined-in-23",level:4}],m={toc:o};function s(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Constructor to build a model instance based on schema and options.\nProvides methods to handle documents of the current collection in the database."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'import { connect, model } from "ottoman";\nconnect("couchbase://localhost/travel-sample@admin:password");\n\n// Create an `User` model\nconst User = model(\'User\', { name: String });\n')),(0,r.kt)("h2",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new IModel"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("p",null,"Creates a document from this model.\nImplements schema validations, defaults, methods, static and hooks"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CastOptions"))))),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L29"},"model/model.ts:29")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"namespace"},"namespace"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"namespace"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Return string value with the model context"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"console.log(User.namespace)\n// `travel-sample`.`inventory`.`user`\n")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L510"},"model/model.ts:510")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"count"},"count"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"count"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Returns the number of documents that match the query."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'User.count({ name: { $like: "%Jane%" } })\n')),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">")))),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L70"},"model/model.ts:70")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"create"},"create"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"create"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",">"),(0,r.kt)("p",null,"Creates a new document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = await User.create({ name: "John Doe" });\n')),(0,r.kt)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/saveOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"saveOptions")))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",">"),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L110"},"model/model.ts:110")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"createmany"},"createMany"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"createMany"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"docs"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">",">"),(0,r.kt)("p",null,"Creates many documents at once."),(0,r.kt)("p",null,"The response status will be ",(0,r.kt)("strong",{parentName:"p"},"SUCCESS")," as long as no error occurs, otherwise it will be ",(0,r.kt)("strong",{parentName:"p"},"FAILURE"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = await User.createMany([{ name: "John Doe" }, { name: "Jane Doe" }]);\n')),(0,r.kt)("h4",{id:"type-parameters-2"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"docs")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),"[]")))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">",">"),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L122"},"model/model.ts:122")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"dropcollection"},"dropCollection"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"dropCollection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collectionName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean"),">"),(0,r.kt)("p",null,"dropCollection drops a collection from a scope in a bucket."),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collectionName?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options.timeout?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number"))))),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean"),">"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L518"},"model/model.ts:518")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"find"},"find"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"find"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Finds documents."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'User.find({ name: "Jane" })\n// will return a list of all users with the name "Jane"\n\nUser.find({ name: "Jane" }, { limit: 10 })\n// will return a list of all users with the name "Jane" and limited to 10 items\n\nUser.find({ name: "Jane" }, { ignoreCase: true })\n// will return a list of all users with the name "Jane" ignoring case\n\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const filter = {\n$or: [{ price: { $gt: 'amount_val', $isNotNull: true } }, { auto: { $gt: 10 } }, { amount: 10 }],\n$and: [\n { price2: { $gt: 1.99, $isNotNull: true } },\n { $or: [{ price3: { $gt: 1.99, $isNotNull: true } }, { id: '20' }] },\n {name: { $eq: 'John', $ignoreCase: true }}\n ],\n};\nUser.find(filter)\n// Returns a list of the elements that match the applied filters.\n")),(0,r.kt)("h4",{id:"type-parameters-3"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOptions")))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L60"},"model/model.ts:60")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"findbyid"},"findById"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Retrieves a document by id."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"User.findById('userId')\n// will return the user document by id.\n\nUser.findById('userId', {select: 'name, cards', populate: 'cards'})\n// will return the user document by id with only the fields name, and cards populated.\n")),(0,r.kt)("h4",{id:"type-parameters-4"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindByIdOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindByIdOptions")))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L84"},"model/model.ts:84")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-5"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindByIdOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindByIdOptions")))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L85"},"model/model.ts:85")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"findone"},"findOne"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOne"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Finds a document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'User.findOne({ name: "Jane" })\n// will return a document with a User name of "Jane", or if it doesn\'t exist, throw a DocumentNotFoundError exception.\n\nUser.findOne({ name: "Jane" }, { ignoreCase: true })\n// will return a document with a User name of "Jane", ignoring the case.\n')),(0,r.kt)("h4",{id:"type-parameters-6"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOptions")))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L99"},"model/model.ts:99")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOne"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-7"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-9"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOptions")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L100"},"model/model.ts:100")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"findoneandremove"},"findOneAndRemove"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOneAndRemove"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Finds a document that matches the conditions of the collection and remove it."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.findOneAndRemove({ name: { $like: '%John Doe%' } })\n")),(0,r.kt)("h4",{id:"type-parameters-8"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-10"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Filter Condition ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/query.html#where"},"Where Expression"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L488"},"model/model.ts:488")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOneAndRemove"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-9"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-11"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">")))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L489"},"model/model.ts:489")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"findoneandupdate"},"findOneAndUpdate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOneAndUpdate"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"doc?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Finds a document that matches the conditions of the collection and updates it."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.findOneAndUpdate({ name: { $like: '%John Doe%' } }, { name: \"John\" })\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Using findOneAndUpdate on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const cardData = {\n cardNumber: '5678 5678 5678 5678',\n zipCode: '56789',\n};\n\nconst cardDataUpdate = {\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210',\n};\n\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\nconst Card = model('Card', CardSchema);\nconst {id} = await Card.create(cardData);\n\n// with strategy:CAST_STRATEGY.THROW\nawait Card.findOneAndUpdate({ cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate, {\n new: true,\n strict: CAST_STRATEGY.THROW,\n});\n// ImmutableError: Field 'cardNumber' is immutable and current cast strategy is set to 'throw'\n\n// with strategy:true (default)\nawait Card.findOneAndUpdate({ cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate, {\n new: true,\n strict: true,\n});\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'5678 5678 5678 5678', zipCode:'43210'} only zipCode was changed\n\n// with strategy:false\nawait Card.findOneAndUpdate({ cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate, {\n new: true,\n strict: false,\n});\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'4321 4321 4321 4321', zipCode:'43210'} all properties were changed\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"ImmutableError")," if findOneAndUpdate is strict:CAST_STRATEGY.THROW and try to modify a immutable property."),(0,r.kt)("h4",{id:"type-parameters-10"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-12"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Filter Condition ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/query.html#where"},"Where Expression"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"doc?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Values for the fields to update")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/FindOneAndUpdateOption"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOneAndUpdateOption"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/findoneandupdateoption.html"},"FindOneAndUpdateOptions")," Return a ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/model.html"},"Model")," if at least one item matching the condition, otherwise an ",(0,r.kt)("a",{parentName:"td",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/DocumentNotFoundError.html"},"exception")," will be thrown. If options.new is ",(0,r.kt)("strong",{parentName:"td"},"true")," return the document after update otherwise by default return the document before update. If options.upsert is ",(0,r.kt)("strong",{parentName:"td"},"true")," insert a document if the document does not exist. options.strict used for strategy to apply on immutables properties")))),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L465"},"model/model.ts:465")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOneAndUpdate"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"doc?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-11"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-13"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"doc?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/FindOneAndUpdateOption"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOneAndUpdateOption")))))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L471"},"model/model.ts:471")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"fromdata"},"fromData"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"fromData"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Creates a ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document"},"document")," from the given data.\nResult will be the same that -> new Model(data)"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = User.fromData({name: "John Doe"});\n// we create a `user` document, but it isn\'t saved yet.\n\nawait user.save();\n// Now user was persisted to DB\n')),(0,r.kt)("h4",{id:"parameters-14"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">")))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L260"},"model/model.ts:260")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"query"},"query"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"query"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"params"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Return a ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/query"},"Query")," instance in the model context"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const query = User.query({name: 'John Smith'})\nconsole.log(query.build())\n// select * from `travel-sample`.`inventory`.`user` where name = 'John Smith'\n")),(0,r.kt)("h4",{id:"parameters-15"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr")))))),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L500"},"model/model.ts:500")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"removebyid"},"removeById"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"removeById"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<{ ",(0,r.kt)("inlineCode",{parentName:"p"},"cas"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")," }",">"),(0,r.kt)("p",null,"Removes a document by id."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.removeById('userId');\n")),(0,r.kt)("h4",{id:"parameters-16"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<{ ",(0,r.kt)("inlineCode",{parentName:"p"},"cas"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")," }",">"),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L245"},"model/model.ts:245")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"removemany"},"removeMany"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"removeMany"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("p",null,"Deletes all of the documents that match conditions from the collection."),(0,r.kt)("p",null,"The response status will be ",(0,r.kt)("strong",{parentName:"p"},"SUCCESS")," as long as no error occurs, otherwise it will be ",(0,r.kt)("strong",{parentName:"p"},"FAILURE"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.removeMany({ name: { $like: '%John Doe%' } })\n// Could also use:\nconst result = await User.removeMany({ name:'John Doe' }, { ignoreCase: true })\n")),(0,r.kt)("h4",{id:"type-parameters-12"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"parameters-17"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Filter Condition ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/query.html"},"Where Expression"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOptions"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/findoptions.html#class-findoptions"},"Find Options"))))),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L279"},"model/model.ts:279")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"replacebyid"},"replaceById"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"replaceById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Same as ",(0,r.kt)("strong",{parentName:"p"},"updateById"),", except it replaces the existing document with the given document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const user = await User.replaceById('userId', {name: \"John Doe\"});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Using replaceById on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const cardData = {\n cardNumber: '5678 5678 5678 5678',\n zipCode: '56789',\n};\n\nconst cardDataUpdate = {\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210',\n};\n\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\nconst Card = model('Card', CardSchema);\nconst {id} = await Card.create(cardData);\n\n// with strategy:CAST_STRATEGY.THROW\nawait Card.replaceById(id, cardDataUpdate, { strict: CAST_STRATEGY.THROW });\n// ImmutableError: Field 'cardNumber' is immutable and current cast strategy is set to 'throw'\n\n// with strategy:true (default)\nawait Card.replaceById(id, cardDataUpdate, { strict: true });\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'5678 5678 5678 5678', zipCode:'43210'} only zipCode was changed\n\n// with strategy:false\nawait Card.replaceById(id, cardDataUpdate, { strict: false });\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'4321 4321 4321 4321', zipCode:'43210'} all properties were changed\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"DocumentNotFoundError")," if the document not exist."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"ImmutableError")," if replaceById is strict:CAST_STRATEGY.THROW and try to modify a immutable property."),(0,r.kt)("h4",{id:"type-parameters-13"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-18"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions")))))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L225"},"model/model.ts:225")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"replaceById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-14"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-19"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions")))))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L231"},"model/model.ts:231")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"updatebyid"},"updateById"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"updateById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Updates a document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const user = await User.updateById('userId', {name: \"John Doe\"});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Using updateById on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const cardData = {\n cardNumber: '5678 5678 5678 5678',\n zipCode: '56789',\n};\n\nconst cardDataUpdate = {\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210',\n};\n\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\nconst Card = model('Card', CardSchema);\nconst {id} = await Card.create(cardData);\n\n// with strategy:CAST_STRATEGY.THROW\nawait Card.updateById(id, cardDataUpdate, { strict: CAST_STRATEGY.THROW });\n// ImmutableError: Field 'cardNumber' is immutable and current cast strategy is set to 'throw'\n\n// with strategy:true (default)\nawait Card.updateById(id, cardDataUpdate, { strict: true });\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'5678 5678 5678 5678', zipCode:'43210'} only zipCode was changed\n\n// with strategy:false\nawait Card.updateById(id, cardDataUpdate, { strict: false });\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'4321 4321 4321 4321', zipCode:'43210'} all properties were changed\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"ImmutableError")," if updateById is strict:CAST_STRATEGY.THROW and try to modify a immutable property."),(0,r.kt)("h4",{id:"type-parameters-15"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-20"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">"," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions")))))),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L168"},"model/model.ts:168")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"updateById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-16"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-21"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">"," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions")))))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L174"},"model/model.ts:174")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"updatemany"},"updateMany"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"updateMany"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"doc?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">",">"),(0,r.kt)("p",null,"Updates all of the documents that match conditions from the collection."),(0,r.kt)("p",null,"The response status will be ",(0,r.kt)("strong",{parentName:"p"},"SUCCESS")," as long as no error occurs, otherwise it will be ",(0,r.kt)("strong",{parentName:"p"},"FAILURE"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.updateMany({ name: { $like: '%John Doe%' } })\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Using immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'\n // Function helper for example\nasync function updateManyHelper(result: any[], strict: ApplyStrategy = true) {\n // First define the schema\n const CardSchema = new Schema({\n cardNumber: String,\n zipCode: { type: String, immutable: true },\n });\n\n //The model is created\n const Card = model(\'CardMany\', CardSchema);\n\n // Created elements are stored here\n let card1;\n let card2;\n\n const batchCreate = async () => {\n card1 = await Card.create({ cardNumber: \'5678 5678 1111 1111\', zipCode: \'11111\' });\n card2 = await Card.create({ cardNumber: \'5678 5678 2222 2222\', zipCode: \'22222\' });\n };\n\n // Create elements\n await batchCreate();\n\n // Update by some criteria\n const response: IManyQueryResponse = await Card.updateMany(\n { cardNumber: { $like: \'%5678 5678%\' } },\n { zipCode: \'12345\', cardNumber: \'0000 0000 0000 0000\' },\n { strict },\n );\n const result1 = await Card.findById(card1.id);\n const result2 = await Card.findById(card2.id);\n\n // Reset data before end test round\n const cleanUp = async () => await Card.removeMany({ _type: \'CardMany\' });\n await cleanUp();\n\n // Return results and response\n result.push(result1, result2, response);\n }\n\n // Store data to check response on each round\nlet result: any[] = [];\n\nasync function testRounds(){\n\n // Round 1: updateMany with strategy:false\n await updateManyHelper(result, false);\n const [result1, result2, response] = result;\n console.log(result1); // {"cardNumber":"0000 0000 0000 0000","zipCode":"12345"} both properties have been changed\n console.log(result2); // {"cardNumber":"0000 0000 0000 0000","zipCode":"12345"} both properties have been changed\n console.log(response); // {"status":"SUCCESS","message":{"success":2,"match_number":2,"errors":[]}}\n result = [];\n\n // Round 2: updateMany with strategy:true\n await updateManyHelper(result, true);\n const [result1, result2, response] = result;\n console.log(result1); // {"cardNumber":"0000 0000 0000 0000","zipCode":"11111"} only cardNumber has changed\n console.log(result2); // {"cardNumber":"0000 0000 0000 0000","zipCode":"22222"} only cardNumber has changed\n console.log(response); // {"status":"SUCCESS","message":{"success":2,"match_number":2,"errors":[]}}\n result = [];\n\n // Round 3: updateMany with strategy:CAST_STRATEGY.THROW\n await updateManyHelper(result, CAST_STRATEGY.THROW);\n const [result1, result2, response] = result;\n console.log(result1); // {"cardNumber":"5678 5678 1111 1111","zipCode":"11111"} only cardNumber has changed\n console.log(result2); // {"cardNumber":"5678 5678 2222 2222","zipCode":"22222"} only cardNumber has changed\n console.log(response); // {"status":"SUCCESS","message":{"success":2,"match_number":2,"errors":[]}}\n result = [];\n\n // RESPONSE FAILURE\n // {\n // "status": "FAILURE",\n // "message": {\n // "success": 0,\n // "match_number": 2,\n // "errors": [\n // {\n // "status": "FAILURE",\n // "exception": "ImmutableError",\n // "message": "Field \'zipCode\' is immutable and current cast strategy is set to \'throw\'"\n // },\n // {\n // "status": "FAILURE",\n // "exception": "ImmutableError",\n // "message": "Field \'zipCode\' is immutable and current cast strategy is set to \'throw\'"\n // }\n // ]\n // }\n // }\n }\n// Test rounds are run\ntestRounds();\n')),(0,r.kt)("h4",{id:"type-parameters-17"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-22"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Filter Condition ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/query.html"},"Where Expression"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"doc?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Values for the fields to update")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/UpdateManyOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"UpdateManyOptions"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/updatemanyoptions.html"},"Update Many Options"))))),(0,r.kt)("h4",{id:"returns-21"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">",">"),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.ts#L396"},"model/model.ts:396")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f45ac2d9.82e3def2.js b/assets/js/f45ac2d9.82e3def2.js new file mode 100644 index 00000000..957d350f --- /dev/null +++ b/assets/js/f45ac2d9.82e3def2.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[367],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>N});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),k=o(a),N=r,u=k["".concat(d,".").concat(N)]||k[N]||s[N]||l;return a?n.createElement(u,i(i({ref:t},m),{},{components:a})):n.createElement(u,i({ref:t},m))}));function N(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>s,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const l={id:"IModel",title:"Interface: IModel",sidebar_label:"IModel",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/interfaces/IModel",id:"api/interfaces/IModel",title:"Interface: IModel",description:"Constructor to build a model instance based on schema and options.",source:"@site/docs/api/interfaces/IModel.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/IModel",permalink:"/docs/api/interfaces/IModel",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"IModel",title:"Interface: IModel",sidebar_label:"IModel",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"IManyQueryResponse",permalink:"/docs/api/interfaces/IManyQueryResponse"},next:{title:"IStatusExecution",permalink:"/docs/api/interfaces/IStatusExecution"}},d={},o=[{value:"Type parameters",id:"type-parameters",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"collectionName",id:"collectionname",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"namespace",id:"namespace",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"Methods",id:"methods",level:2},{value:"count",id:"count",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-3",level:4},{value:"create",id:"create",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-4",level:4},{value:"createMany",id:"createmany",level:3},{value:"Type parameters",id:"type-parameters-2",level:4},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-5",level:4},{value:"dropCollection",id:"dropcollection",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"find",id:"find",level:3},{value:"Type parameters",id:"type-parameters-3",level:4},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-7",level:4},{value:"findById",id:"findbyid",level:3},{value:"Type parameters",id:"type-parameters-4",level:4},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-8",level:4},{value:"Type parameters",id:"type-parameters-5",level:4},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-9",level:4},{value:"findOne",id:"findone",level:3},{value:"Type parameters",id:"type-parameters-6",level:4},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-10",level:4},{value:"Type parameters",id:"type-parameters-7",level:4},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-11",level:4},{value:"findOneAndRemove",id:"findoneandremove",level:3},{value:"Type parameters",id:"type-parameters-8",level:4},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"Type parameters",id:"type-parameters-9",level:4},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"findOneAndUpdate",id:"findoneandupdate",level:3},{value:"Type parameters",id:"type-parameters-10",level:4},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"Type parameters",id:"type-parameters-11",level:4},{value:"Parameters",id:"parameters-13",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-15",level:4},{value:"fromData",id:"fromdata",level:3},{value:"Parameters",id:"parameters-14",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Defined in",id:"defined-in-16",level:4},{value:"query",id:"query",level:3},{value:"Parameters",id:"parameters-15",level:4},{value:"Returns",id:"returns-14",level:4},{value:"Defined in",id:"defined-in-17",level:4},{value:"removeById",id:"removebyid",level:3},{value:"Parameters",id:"parameters-16",level:4},{value:"Returns",id:"returns-15",level:4},{value:"Defined in",id:"defined-in-18",level:4},{value:"removeMany",id:"removemany",level:3},{value:"Type parameters",id:"type-parameters-12",level:4},{value:"Parameters",id:"parameters-17",level:4},{value:"Returns",id:"returns-16",level:4},{value:"Defined in",id:"defined-in-19",level:4},{value:"replaceById",id:"replacebyid",level:3},{value:"Type parameters",id:"type-parameters-13",level:4},{value:"Parameters",id:"parameters-18",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"Type parameters",id:"type-parameters-14",level:4},{value:"Parameters",id:"parameters-19",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"updateById",id:"updatebyid",level:3},{value:"Type parameters",id:"type-parameters-15",level:4},{value:"Parameters",id:"parameters-20",level:4},{value:"Returns",id:"returns-19",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"Type parameters",id:"type-parameters-16",level:4},{value:"Parameters",id:"parameters-21",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"updateMany",id:"updatemany",level:3},{value:"Type parameters",id:"type-parameters-17",level:4},{value:"Parameters",id:"parameters-22",level:4},{value:"Returns",id:"returns-21",level:4},{value:"Defined in",id:"defined-in-24",level:4}],m={toc:o};function s(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("p",null,"Constructor to build a model instance based on schema and options.\nProvides methods to handle documents of the current collection in the database."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'import { connect, model } from "ottoman";\nconnect("couchbase://localhost/travel-sample@admin:password");\n\n// Create an `User` model\nconst User = model(\'User\', { name: String });\n')),(0,r.kt)("h2",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new IModel"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),")"),(0,r.kt)("p",null,"Creates a document from this model.\nImplements schema validations, defaults, methods, static and hooks"),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CastOptions"))))),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L29"},"model/model.ts:29")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"collectionname"},"collectionName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"collectionName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Return string value with the model collection name"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'console.log(User.collectionName)\n// "User"\n')),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L523"},"model/model.ts:523")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"namespace"},"namespace"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"namespace"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Return string value with the model context"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"console.log(User.namespace)\n// `travel-sample`.`inventory`.`user`\n")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L513"},"model/model.ts:513")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"count"},"count"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"count"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Returns the number of documents that match the query."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'User.count({ name: { $like: "%Jane%" } })\n')),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CountOptions"))))),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L70"},"model/model.ts:70")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"create"},"create"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"create"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",">"),(0,r.kt)("p",null,"Creates a new document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = await User.create({ name: "John Doe" });\n')),(0,r.kt)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/saveOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"saveOptions")))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",">"),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L110"},"model/model.ts:110")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"createmany"},"createMany"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"createMany"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"docs"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">",">"),(0,r.kt)("p",null,"Creates many documents at once."),(0,r.kt)("p",null,"The response status will be ",(0,r.kt)("strong",{parentName:"p"},"SUCCESS")," as long as no error occurs, otherwise it will be ",(0,r.kt)("strong",{parentName:"p"},"FAILURE"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = await User.createMany([{ name: "John Doe" }, { name: "Jane Doe" }]);\n')),(0,r.kt)("h4",{id:"type-parameters-2"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"docs")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),"[]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/saveOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"saveOptions")))))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">",">"),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L122"},"model/model.ts:122")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"dropcollection"},"dropCollection"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"dropCollection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collectionName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean"),">"),(0,r.kt)("p",null,"dropCollection drops a collection from a scope in a bucket."),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collectionName?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options.timeout?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number"))))),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"undefined")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean"),">"),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L531"},"model/model.ts:531")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"find"},"find"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"find"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Finds documents."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'User.find({ name: "Jane" })\n// will return a list of all users with the name "Jane"\n\nUser.find({ name: "Jane" }, { limit: 10 })\n// will return a list of all users with the name "Jane" and limited to 10 items\n\nUser.find({ name: "Jane" }, { ignoreCase: true })\n// will return a list of all users with the name "Jane" ignoring case\n\n')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const filter = {\n$or: [{ price: { $gt: 'amount_val', $isNotNull: true } }, { auto: { $gt: 10 } }, { amount: 10 }],\n$and: [\n { price2: { $gt: 1.99, $isNotNull: true } },\n { $or: [{ price3: { $gt: 1.99, $isNotNull: true } }, { id: '20' }] },\n {name: { $eq: 'John', $ignoreCase: true }}\n ],\n};\nUser.find(filter)\n// Returns a list of the elements that match the applied filters.\n")),(0,r.kt)("h4",{id:"type-parameters-3"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOptions")))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L60"},"model/model.ts:60")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"findbyid"},"findById"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Retrieves a document by id."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"User.findById('userId')\n// will return the user document by id.\n\nUser.findById('userId', {select: 'name, cards', populate: 'cards'})\n// will return the user document by id with only the fields name, and cards populated.\n")),(0,r.kt)("h4",{id:"type-parameters-4"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindByIdOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindByIdOptions")))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L84"},"model/model.ts:84")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-5"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindByIdOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindByIdOptions")))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L85"},"model/model.ts:85")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"findone"},"findOne"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOne"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Finds a document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'User.findOne({ name: "Jane" })\n// will return a document with a User name of "Jane", or if it doesn\'t exist, throw a DocumentNotFoundError exception.\n\nUser.findOne({ name: "Jane" }, { ignoreCase: true })\n// will return a document with a User name of "Jane", ignoring the case.\n')),(0,r.kt)("h4",{id:"type-parameters-6"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOptions")))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L99"},"model/model.ts:99")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOne"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-7"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-9"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOptions")))))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L100"},"model/model.ts:100")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"findoneandremove"},"findOneAndRemove"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOneAndRemove"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Finds a document that matches the conditions of the collection and remove it."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.findOneAndRemove({ name: { $like: '%John Doe%' } })\n")),(0,r.kt)("h4",{id:"type-parameters-8"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-10"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Filter Condition ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/query.html#where"},"Where Expression"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L491"},"model/model.ts:491")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOneAndRemove"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-9"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-11"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">")))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L492"},"model/model.ts:492")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"findoneandupdate"},"findOneAndUpdate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOneAndUpdate"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"doc?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Finds a document that matches the conditions of the collection and updates it."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.findOneAndUpdate({ name: { $like: '%John Doe%' } }, { name: \"John\" })\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Using findOneAndUpdate on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const cardData = {\n cardNumber: '5678 5678 5678 5678',\n zipCode: '56789',\n};\n\nconst cardDataUpdate = {\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210',\n};\n\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\nconst Card = model('Card', CardSchema);\nconst {id} = await Card.create(cardData);\n\n// with strategy:CAST_STRATEGY.THROW\nawait Card.findOneAndUpdate({ cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate, {\n new: true,\n strict: CAST_STRATEGY.THROW,\n});\n// ImmutableError: Field 'cardNumber' is immutable and current cast strategy is set to 'throw'\n\n// with strategy:true (default)\nawait Card.findOneAndUpdate({ cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate, {\n new: true,\n strict: true,\n});\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'5678 5678 5678 5678', zipCode:'43210'} only zipCode was changed\n\n// with strategy:false\nawait Card.findOneAndUpdate({ cardNumber: { $like: '%5678 5678 5678 5678%' } }, cardDataUpdate, {\n new: true,\n strict: false,\n});\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'4321 4321 4321 4321', zipCode:'43210'} all properties were changed\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"ImmutableError")," if findOneAndUpdate is strict:CAST_STRATEGY.THROW and try to modify a immutable property."),(0,r.kt)("h4",{id:"type-parameters-10"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-12"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Filter Condition ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/query.html#where"},"Where Expression"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"doc?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Values for the fields to update")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/FindOneAndUpdateOption"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOneAndUpdateOption"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/findoneandupdateoption.html"},"FindOneAndUpdateOptions")," Return a ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/model.html"},"Model")," if at least one item matching the condition, otherwise an ",(0,r.kt)("a",{parentName:"td",href:"https://docs.couchbase.com/sdk-api/couchbase-node-client/classes/DocumentNotFoundError.html"},"exception")," will be thrown. If options.new is ",(0,r.kt)("strong",{parentName:"td"},"true")," return the document after update otherwise by default return the document before update. If options.upsert is ",(0,r.kt)("strong",{parentName:"td"},"true")," insert a document if the document does not exist. options.strict used for strategy to apply on immutables properties")))),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L468"},"model/model.ts:468")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"findOneAndUpdate"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"doc?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-11"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-13"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"doc?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/FindOneAndUpdateOption"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOneAndUpdateOption")))))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L474"},"model/model.ts:474")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"fromdata"},"fromData"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"fromData"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"Creates a ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/document"},"document")," from the given data.\nResult will be the same that -> new Model(data)"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},'const user = User.fromData({name: "John Doe"});\n// we create a `user` document, but it isn\'t saved yet.\n\nawait user.save();\n// Now user was persisted to DB\n')),(0,r.kt)("h4",{id:"parameters-14"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">")))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L263"},"model/model.ts:263")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"query"},"query"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"query"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"params"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Return a ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/query"},"Query")," instance in the model context"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const query = User.query({name: 'John Smith'})\nconsole.log(query.build())\n// select * from `travel-sample`.`inventory`.`user` where name = 'John Smith'\n")),(0,r.kt)("h4",{id:"parameters-15"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr")))))),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L503"},"model/model.ts:503")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"removebyid"},"removeById"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"removeById"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<{ ",(0,r.kt)("inlineCode",{parentName:"p"},"cas"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")," }",">"),(0,r.kt)("p",null,"Removes a document by id."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.removeById('userId');\n")),(0,r.kt)("h4",{id:"parameters-16"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CountOptions"))))),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<{ ",(0,r.kt)("inlineCode",{parentName:"p"},"cas"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"any")," }",">"),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L248"},"model/model.ts:248")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"removemany"},"removeMany"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"removeMany"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("p",null,"Deletes all of the documents that match conditions from the collection."),(0,r.kt)("p",null,"The response status will be ",(0,r.kt)("strong",{parentName:"p"},"SUCCESS")," as long as no error occurs, otherwise it will be ",(0,r.kt)("strong",{parentName:"p"},"FAILURE"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.removeMany({ name: { $like: '%John Doe%' } })\n// Could also use:\nconst result = await User.removeMany({ name:'John Doe' }, { ignoreCase: true })\n")),(0,r.kt)("h4",{id:"type-parameters-12"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"parameters-17"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Filter Condition ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/query.html"},"Where Expression"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/FindOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"FindOptions"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/findoptions.html#class-findoptions"},"Find Options"))))),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L282"},"model/model.ts:282")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"replacebyid"},"replaceById"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"replaceById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Same as ",(0,r.kt)("strong",{parentName:"p"},"updateById"),", except it replaces the existing document with the given document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const user = await User.replaceById('userId', {name: \"John Doe\"});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Using replaceById on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const cardData = {\n cardNumber: '5678 5678 5678 5678',\n zipCode: '56789',\n};\n\nconst cardDataUpdate = {\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210',\n};\n\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\nconst Card = model('Card', CardSchema);\nconst {id} = await Card.create(cardData);\n\n// with strategy:CAST_STRATEGY.THROW\nawait Card.replaceById(id, cardDataUpdate, { strict: CAST_STRATEGY.THROW });\n// ImmutableError: Field 'cardNumber' is immutable and current cast strategy is set to 'throw'\n\n// with strategy:true (default)\nawait Card.replaceById(id, cardDataUpdate, { strict: true });\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'5678 5678 5678 5678', zipCode:'43210'} only zipCode was changed\n\n// with strategy:false\nawait Card.replaceById(id, cardDataUpdate, { strict: false });\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'4321 4321 4321 4321', zipCode:'43210'} all properties were changed\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"DocumentNotFoundError")," if the document not exist."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"ImmutableError")," if replaceById is strict:CAST_STRATEGY.THROW and try to modify a immutable property."),(0,r.kt)("h4",{id:"type-parameters-13"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-18"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions")))))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L228"},"model/model.ts:228")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"replaceById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-14"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-19"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions")))))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L234"},"model/model.ts:234")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"updatebyid"},"updateById"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"updateById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("p",null,"Updates a document."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const user = await User.updateById('userId', {name: \"John Doe\"});\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Using updateById on immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},"const cardData = {\n cardNumber: '5678 5678 5678 5678',\n zipCode: '56789',\n};\n\nconst cardDataUpdate = {\n cardNumber: '4321 4321 4321 4321',\n zipCode: '43210',\n};\n\nconst CardSchema = new Schema({\n cardNumber: { type: String, immutable: true },\n zipCode: String,\n});\nconst Card = model('Card', CardSchema);\nconst {id} = await Card.create(cardData);\n\n// with strategy:CAST_STRATEGY.THROW\nawait Card.updateById(id, cardDataUpdate, { strict: CAST_STRATEGY.THROW });\n// ImmutableError: Field 'cardNumber' is immutable and current cast strategy is set to 'throw'\n\n// with strategy:true (default)\nawait Card.updateById(id, cardDataUpdate, { strict: true });\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'5678 5678 5678 5678', zipCode:'43210'} only zipCode was changed\n\n// with strategy:false\nawait Card.updateById(id, cardDataUpdate, { strict: false });\nconst result = await Card.findById(id);\nconsole.log(result); // {cardNumber:'4321 4321 4321 4321', zipCode:'43210'} all properties were changed\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},"ImmutableError")," if updateById is strict:CAST_STRATEGY.THROW and try to modify a immutable property."),(0,r.kt)("h4",{id:"type-parameters-15"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-20"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">"," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions")))))),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L171"},"model/model.ts:171")),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"updateById"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Doc"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"id"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"type-parameters-16"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R"))))),(0,r.kt)("h4",{id:"parameters-21"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"id")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Doc")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">"," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Doc"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#mutationfunctionoptions"},(0,r.kt)("inlineCode",{parentName:"a"},"MutationFunctionOptions")))))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L177"},"model/model.ts:177")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"updatemany"},"updateMany"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"updateMany"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"filter?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"doc?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">",">"),(0,r.kt)("p",null,"Updates all of the documents that match conditions from the collection."),(0,r.kt)("p",null,"The response status will be ",(0,r.kt)("strong",{parentName:"p"},"SUCCESS")," as long as no error occurs, otherwise it will be ",(0,r.kt)("strong",{parentName:"p"},"FAILURE"),"."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-javascript"},"const result = await User.updateMany({ name: { $like: '%John Doe%' } })\n")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("p",null,"Using immutable properties"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-typescript"},'\n // Function helper for example\nasync function updateManyHelper(result: any[], strict: ApplyStrategy = true) {\n // First define the schema\n const CardSchema = new Schema({\n cardNumber: String,\n zipCode: { type: String, immutable: true },\n });\n\n //The model is created\n const Card = model(\'CardMany\', CardSchema);\n\n // Created elements are stored here\n let card1;\n let card2;\n\n const batchCreate = async () => {\n card1 = await Card.create({ cardNumber: \'5678 5678 1111 1111\', zipCode: \'11111\' });\n card2 = await Card.create({ cardNumber: \'5678 5678 2222 2222\', zipCode: \'22222\' });\n };\n\n // Create elements\n await batchCreate();\n\n // Update by some criteria\n const response: IManyQueryResponse = await Card.updateMany(\n { cardNumber: { $like: \'%5678 5678%\' } },\n { zipCode: \'12345\', cardNumber: \'0000 0000 0000 0000\' },\n { strict },\n );\n const result1 = await Card.findById(card1.id);\n const result2 = await Card.findById(card2.id);\n\n // Reset data before end test round\n const cleanUp = async () => await Card.removeMany({ _type: \'CardMany\' });\n await cleanUp();\n\n // Return results and response\n result.push(result1, result2, response);\n }\n\n // Store data to check response on each round\nlet result: any[] = [];\n\nasync function testRounds(){\n\n // Round 1: updateMany with strategy:false\n await updateManyHelper(result, false);\n const [result1, result2, response] = result;\n console.log(result1); // {"cardNumber":"0000 0000 0000 0000","zipCode":"12345"} both properties have been changed\n console.log(result2); // {"cardNumber":"0000 0000 0000 0000","zipCode":"12345"} both properties have been changed\n console.log(response); // {"status":"SUCCESS","message":{"success":2,"match_number":2,"errors":[]}}\n result = [];\n\n // Round 2: updateMany with strategy:true\n await updateManyHelper(result, true);\n const [result1, result2, response] = result;\n console.log(result1); // {"cardNumber":"0000 0000 0000 0000","zipCode":"11111"} only cardNumber has changed\n console.log(result2); // {"cardNumber":"0000 0000 0000 0000","zipCode":"22222"} only cardNumber has changed\n console.log(response); // {"status":"SUCCESS","message":{"success":2,"match_number":2,"errors":[]}}\n result = [];\n\n // Round 3: updateMany with strategy:CAST_STRATEGY.THROW\n await updateManyHelper(result, CAST_STRATEGY.THROW);\n const [result1, result2, response] = result;\n console.log(result1); // {"cardNumber":"5678 5678 1111 1111","zipCode":"11111"} only cardNumber has changed\n console.log(result2); // {"cardNumber":"5678 5678 2222 2222","zipCode":"22222"} only cardNumber has changed\n console.log(response); // {"status":"SUCCESS","message":{"success":2,"match_number":2,"errors":[]}}\n result = [];\n\n // RESPONSE FAILURE\n // {\n // "status": "FAILURE",\n // "message": {\n // "success": 0,\n // "match_number": 2,\n // "errors": [\n // {\n // "status": "FAILURE",\n // "exception": "ImmutableError",\n // "message": "Field \'zipCode\' is immutable and current cast strategy is set to \'throw\'"\n // },\n // {\n // "status": "FAILURE",\n // "exception": "ImmutableError",\n // "message": "Field \'zipCode\' is immutable and current cast strategy is set to \'throw\'"\n // }\n // ]\n // }\n // }\n }\n// Test rounds are run\ntestRounds();\n')),(0,r.kt)("h4",{id:"type-parameters-17"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-22"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"filter?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"Query"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Filter Condition ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/query.html"},"Where Expression"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"doc?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Partial"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"T"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"Values for the fields to update")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/UpdateManyOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"UpdateManyOptions"))),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/updatemanyoptions.html"},"Update Many Options"))))),(0,r.kt)("h4",{id:"returns-21"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/ManyQueryResponse"},(0,r.kt)("inlineCode",{parentName:"a"},"ManyQueryResponse")),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">",">"),(0,r.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.ts#L399"},"model/model.ts:399")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f60a93e3.312b32a1.js b/assets/js/f60a93e3.2d459cec.js similarity index 98% rename from assets/js/f60a93e3.312b32a1.js rename to assets/js/f60a93e3.2d459cec.js index e1d1b488..cc5bad5b 100644 --- a/assets/js/f60a93e3.312b32a1.js +++ b/assets/js/f60a93e3.2d459cec.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6315],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var n=r(7462),o=(r(7294),r(3905));const a={id:"SelectClauseException",title:"Class: SelectClauseException",sidebar_label:"SelectClauseException",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/SelectClauseException",id:"api/classes/SelectClauseException",title:"Class: SelectClauseException",description:"Hierarchy",source:"@site/docs/api/classes/SelectClauseException.md",sourceDirName:"api/classes",slug:"/api/classes/SelectClauseException",permalink:"/docs/api/classes/SelectClauseException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"SelectClauseException",title:"Class: SelectClauseException",sidebar_label:"SelectClauseException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Schema",permalink:"/docs/api/classes/Schema"},next:{title:"StringType",permalink:"/docs/api/classes/StringType"}},c={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:s};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,o.kt)("p",{parentName:"li"},"\u21b3 ",(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("inlineCode",{parentName:"strong"},"SelectClauseException"))))),(0,o.kt)("h2",{id:"constructors"},"Constructors"),(0,o.kt)("h3",{id:"constructor"},"constructor"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("strong",{parentName:"p"},"new SelectClauseException"),"()"),(0,o.kt)("h4",{id:"overrides"},"Overrides"),(0,o.kt)("p",null,"OttomanError.constructor"),(0,o.kt)("h4",{id:"defined-in"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/exceptions.ts#L4"},"query/exceptions.ts:4")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6315],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(7294);function o(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}var c=n.createContext({}),s=function(e){var t=n.useContext(c),r=t;return e&&(r="function"==typeof e?e(t):i(i({},t),e)),r},p=function(e){var t=s(e.components);return n.createElement(c.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var r=e.components,o=e.mdxType,a=e.originalType,c=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),d=s(r),m=o,f=d["".concat(c,".").concat(m)]||d[m]||u[m]||a;return r?n.createElement(f,i(i({ref:t},p),{},{components:r})):n.createElement(f,i({ref:t},p))}));function m(e,t){var r=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=r.length,i=new Array(a);i[0]=d;var l={};for(var c in t)hasOwnProperty.call(t,c)&&(l[c]=t[c]);l.originalType=e,l.mdxType="string"==typeof e?e:o,i[1]=l;for(var s=2;s{r.r(t),r.d(t,{assets:()=>c,contentTitle:()=>i,default:()=>u,frontMatter:()=>a,metadata:()=>l,toc:()=>s});var n=r(7462),o=(r(7294),r(3905));const a={id:"SelectClauseException",title:"Class: SelectClauseException",sidebar_label:"SelectClauseException",sidebar_position:0,custom_edit_url:null},i=void 0,l={unversionedId:"api/classes/SelectClauseException",id:"api/classes/SelectClauseException",title:"Class: SelectClauseException",description:"Hierarchy",source:"@site/docs/api/classes/SelectClauseException.md",sourceDirName:"api/classes",slug:"/api/classes/SelectClauseException",permalink:"/docs/api/classes/SelectClauseException",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"SelectClauseException",title:"Class: SelectClauseException",sidebar_label:"SelectClauseException",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Schema",permalink:"/docs/api/classes/Schema"},next:{title:"StringType",permalink:"/docs/api/classes/StringType"}},c={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4}],p={toc:s};function u(e){let{components:t,...r}=e;return(0,o.kt)("wrapper",(0,n.Z)({},p,r,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("p",{parentName:"li"},(0,o.kt)("inlineCode",{parentName:"p"},"OttomanError")),(0,o.kt)("p",{parentName:"li"},"\u21b3 ",(0,o.kt)("strong",{parentName:"p"},(0,o.kt)("inlineCode",{parentName:"strong"},"SelectClauseException"))))),(0,o.kt)("h2",{id:"constructors"},"Constructors"),(0,o.kt)("h3",{id:"constructor"},"constructor"),(0,o.kt)("p",null,"\u2022 ",(0,o.kt)("strong",{parentName:"p"},"new SelectClauseException"),"()"),(0,o.kt)("h4",{id:"overrides"},"Overrides"),(0,o.kt)("p",null,"OttomanError.constructor"),(0,o.kt)("h4",{id:"defined-in"},"Defined in"),(0,o.kt)("p",null,(0,o.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/exceptions.ts#L4"},"query/exceptions.ts:4")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f6aebfbf.6b5e555b.js b/assets/js/f6aebfbf.6b5e555b.js new file mode 100644 index 00000000..a3095261 --- /dev/null +++ b/assets/js/f6aebfbf.6b5e555b.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7306],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>u});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),k=o(a),u=r,N=k["".concat(d,".").concat(u)]||k[u]||s[u]||l;return a?n.createElement(N,i(i({ref:t},m),{},{components:a})):n.createElement(N,i({ref:t},m))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>s,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const l={id:"modules",title:"ottoman",sidebar_label:"Exports",sidebar_position:.5,custom_edit_url:null},i=void 0,p={unversionedId:"api/modules",id:"api/modules",title:"ottoman",description:"Enumerations",source:"@site/docs/api/modules.md",sourceDirName:"api",slug:"/api/modules",permalink:"/docs/api/modules",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:.5,frontMatter:{id:"modules",title:"ottoman",sidebar_label:"Exports",sidebar_position:.5,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Readme",permalink:"/docs/api/"},next:{title:"SearchConsistency",permalink:"/docs/api/enums/SearchConsistency"}},d={},o=[{value:"Enumerations",id:"enumerations",level:2},{value:"Classes",id:"classes",level:2},{value:"Interfaces",id:"interfaces",level:2},{value:"Type Aliases",id:"type-aliases",level:2},{value:"AggType",id:"aggtype",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"ComparisonEmptyOperatorType",id:"comparisonemptyoperatortype",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"ComparisonMultipleOperatorType",id:"comparisonmultipleoperatortype",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"ComparisonSingleOperatorType",id:"comparisonsingleoperatortype",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"ComparisonSingleStringOperatorType",id:"comparisonsinglestringoperatortype",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"ComparisonWhereExpr",id:"comparisonwhereexpr",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"IDocument",id:"idocument",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"ISelectAggType",id:"iselectaggtype",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"ISelectType",id:"iselecttype",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"IndexType",id:"indextype",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"LetExprType",id:"letexprtype",level:3},{value:"Defined in",id:"defined-in-10",level:4},{value:"LogicalOperatorType",id:"logicaloperatortype",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"LogicalWhereExpr",id:"logicalwhereexpr",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"ModelTypes",id:"modeltypes",level:3},{value:"Type parameters",id:"type-parameters-2",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"MutationFunctionOptions",id:"mutationfunctionoptions",level:3},{value:"Type declaration",id:"type-declaration",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"ResultExprType",id:"resultexprtype",level:3},{value:"Defined in",id:"defined-in-15",level:4},{value:"ReturnResultType",id:"returnresulttype",level:3},{value:"Defined in",id:"defined-in-16",level:4},{value:"SortType",id:"sorttype",level:3},{value:"Defined in",id:"defined-in-17",level:4},{value:"Variables",id:"variables",level:2},{value:"AggDict",id:"aggdict",level:3},{value:"Defined in",id:"defined-in-18",level:4},{value:"ResultExprDict",id:"resultexprdict",level:3},{value:"Defined in",id:"defined-in-19",level:4},{value:"ReturnResultDict",id:"returnresultdict",level:3},{value:"Defined in",id:"defined-in-20",level:4},{value:"Functions",id:"functions",level:2},{value:"addValidators",id:"addvalidators",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"applyDefaultValue",id:"applydefaultvalue",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"buildIndexExpr",id:"buildindexexpr",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"buildSelectExpr",id:"buildselectexpr",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-24",level:4},{value:"buildWhereClauseExpr",id:"buildwhereclauseexpr",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-25",level:4},{value:"close",id:"close",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-26",level:4},{value:"connect",id:"connect",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-27",level:4},{value:"getCollection",id:"getcollection",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-28",level:4},{value:"getDefaultInstance",id:"getdefaultinstance",level:3},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-29",level:4},{value:"getModel",id:"getmodel",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-30",level:4},{value:"getModelMetadata",id:"getmodelmetadata",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-31",level:4},{value:"getOttomanInstances",id:"getottomaninstances",level:3},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-32",level:4},{value:"getProjectionFields",id:"getprojectionfields",level:3},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-33",level:4},{value:"getValueByPath",id:"getvaluebypath",level:3},{value:"Type parameters",id:"type-parameters-3",level:4},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Defined in",id:"defined-in-34",level:4},{value:"is",id:"is",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-14",level:4},{value:"Defined in",id:"defined-in-35",level:4},{value:"isDocumentNotFoundError",id:"isdocumentnotfounderror",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-15",level:4},{value:"Defined in",id:"defined-in-36",level:4},{value:"isSchemaFactoryType",id:"isschemafactorytype",level:3},{value:"Parameters",id:"parameters-13",level:4},{value:"Returns",id:"returns-16",level:4},{value:"Defined in",id:"defined-in-37",level:4},{value:"isSchemaTypeSupported",id:"isschematypesupported",level:3},{value:"Parameters",id:"parameters-14",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Defined in",id:"defined-in-38",level:4},{value:"model",id:"model",level:3},{value:"Type parameters",id:"type-parameters-4",level:4},{value:"Parameters",id:"parameters-15",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Defined in",id:"defined-in-39",level:4},{value:"parseStringSelectExpr",id:"parsestringselectexpr",level:3},{value:"Parameters",id:"parameters-16",level:4},{value:"Returns",id:"returns-19",level:4},{value:"Defined in",id:"defined-in-40",level:4},{value:"registerGlobalPlugin",id:"registerglobalplugin",level:3},{value:"Parameters",id:"parameters-17",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Defined in",id:"defined-in-41",level:4},{value:"registerType",id:"registertype",level:3},{value:"Parameters",id:"parameters-18",level:4},{value:"Returns",id:"returns-21",level:4},{value:"Defined in",id:"defined-in-42",level:4},{value:"searchQuery",id:"searchquery",level:3},{value:"Parameters",id:"parameters-19",level:4},{value:"Returns",id:"returns-22",level:4},{value:"Defined in",id:"defined-in-43",level:4},{value:"selectBuilder",id:"selectbuilder",level:3},{value:"Parameters",id:"parameters-20",level:4},{value:"Returns",id:"returns-23",level:4},{value:"Defined in",id:"defined-in-44",level:4},{value:"set",id:"set",level:3},{value:"Parameters",id:"parameters-21",level:4},{value:"Returns",id:"returns-24",level:4},{value:"Defined in",id:"defined-in-45",level:4},{value:"setValueByPath",id:"setvaluebypath",level:3},{value:"Type parameters",id:"type-parameters-5",level:4},{value:"Parameters",id:"parameters-22",level:4},{value:"Returns",id:"returns-25",level:4},{value:"Defined in",id:"defined-in-46",level:4},{value:"start",id:"start",level:3},{value:"Returns",id:"returns-26",level:4},{value:"Defined in",id:"defined-in-47",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-23",level:4},{value:"Returns",id:"returns-27",level:4},{value:"Defined in",id:"defined-in-48",level:4}],m={toc:o};function s(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"enumerations"},"Enumerations"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/enums/SearchConsistency"},"SearchConsistency")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/enums/VALIDATION_STRATEGY"},"VALIDATION","_","STRATEGY"))),(0,r.kt)("h2",{id:"classes"},"Classes"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ArrayType"},"ArrayType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/BooleanType"},"BooleanType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/BuildSchemaError"},"BuildSchemaError")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/CoreType"},"CoreType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/DateType"},"DateType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Document"},"Document")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/EmbedType"},"EmbedType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/FindByIdOptions"},"FindByIdOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/FindOptions"},"FindOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/IOttomanType"},"IOttomanType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/IndexParamsOnExceptions"},"IndexParamsOnExceptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/IndexParamsUsingGSIExceptions"},"IndexParamsUsingGSIExceptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ManyQueryResponse"},"ManyQueryResponse")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/MixedType"},"MixedType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Model"},"Model")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/MultipleQueryTypesException"},"MultipleQueryTypesException")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/NumberType"},"NumberType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Ottoman"},"Ottoman")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Query"},"Query")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/QueryGroupByParamsException"},"QueryGroupByParamsException")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/QueryOperatorNotFoundException"},"QueryOperatorNotFoundException")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ReferenceType"},"ReferenceType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Schema"},"Schema")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/SelectClauseException"},"SelectClauseException")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/StringType"},"StringType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ValidationError"},"ValidationError")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ViewIndexOptions"},"ViewIndexOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/WhereClauseException"},"WhereClauseException"))),(0,r.kt)("h2",{id:"interfaces"},"Interfaces"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/CreateModelOptions"},"CreateModelOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/FindOneAndUpdateOption"},"FindOneAndUpdateOption")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IConditionExpr"},"IConditionExpr")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IField"},"IField")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IIndexOnParams"},"IIndexOnParams")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IIndexWithParams"},"IIndexWithParams")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IManyQueryResponse"},"IManyQueryResponse")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IModel"},"IModel")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IStatusExecution"},"IStatusExecution")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/ModelOptions"},"ModelOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/UpdateManyOptions"},"UpdateManyOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/ValidatorOption"},"ValidatorOption")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/saveOptions"},"saveOptions"))),(0,r.kt)("h2",{id:"type-aliases"},"Type Aliases"),(0,r.kt)("h3",{id:"aggtype"},"AggType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"AggType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$arrayAgg"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$avg"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$mean"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$count"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$countn"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$max"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$median"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$min"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$stddev"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$stddevPop"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$stddevSamp"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$sum"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$variance"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$variancePop"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$varianceSamp"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$varPop"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$varSamp"')),(0,r.kt)("p",null,"List of aggregation functions."),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L13"},"query/interface/query.types.ts:13")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonemptyoperatortype"},"ComparisonEmptyOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonEmptyOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isNull"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isNotNull"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isMissing"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isNotMissing"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isValued"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isNotValued"')),(0,r.kt)("p",null,"List of Boolean comparison operators."),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L35"},"query/interface/query.types.ts:35")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonmultipleoperatortype"},"ComparisonMultipleOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonMultipleOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$btw"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$notBtw"')),(0,r.kt)("p",null,"List of Range comparison operators."),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L53"},"query/interface/query.types.ts:53")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonsingleoperatortype"},"ComparisonSingleOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonSingleOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$eq"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$neq"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$gt"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$gte"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$lt"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$lte"')),(0,r.kt)("p",null,"List of Numeric comparison operators."),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L45"},"query/interface/query.types.ts:45")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonsinglestringoperatortype"},"ComparisonSingleStringOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonSingleStringOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$like"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$notLike"')),(0,r.kt)("p",null,"List of String comparison operators."),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L49"},"query/interface/query.types.ts:49")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonwhereexpr"},"ComparisonWhereExpr"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonWhereExpr"),": { ","[key in ComparisonEmptyOperatorType ","|"," ComparisonSingleOperatorType ","|"," ComparisonMultipleOperatorType ","|"," ComparisonSingleStringOperatorType]","?: string ","|"," number ","|"," boolean ","|"," (number ","|"," string)[] } ","|"," { ","[key in CollectionDeepSearchOperatorType]","?: string ","|"," any[] }"),(0,r.kt)("p",null,"Structure of the comparison operators."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{ operator: value } -> e.g { $like: '%ottoman%' }\n")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L129"},"query/interface/query.types.ts:129")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"idocument"},"IDocument"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"IDocument"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",": ",(0,r.kt)("inlineCode",{parentName:"p"},"CleanDocument")," & ",(0,r.kt)("inlineCode",{parentName:"p"},"T")),(0,r.kt)("h4",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/document.ts#L21"},"model/document.ts:21")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"iselectaggtype"},"ISelectAggType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ISelectAggType"),": { ","[key in AggType]","?: ISelectFieldType }"),(0,r.kt)("p",null,"SELECT aggregation expression"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," { $count: { $field: { name: 'address' }, as: 'addr' } } | { $count: { $field: 'address' } }\n")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L194"},"query/interface/query.types.ts:194")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"iselecttype"},"ISelectType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ISelectType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ISelectReturnResultType")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ISelectResultExprType")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#iselectaggtype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectAggType"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ISelectFieldType")),(0,r.kt)("p",null,"SELECT expression"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," { $all: { $field: { name: 'address' }, as: 'addr' }, $field: 'type', $field: { name: 'count' } }\n")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L246"},"query/interface/query.types.ts:246")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indextype"},"IndexType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"IndexType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"CREATE"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"BUILD"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"DROP"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"CREATE PRIMARY"')),(0,r.kt)("p",null,"Types of supported index statements"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L277"},"query/interface/query.types.ts:277")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"letexprtype"},"LetExprType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"LetExprType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown"),">"),(0,r.kt)("p",null,"LET expression"),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L251"},"query/interface/query.types.ts:251")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"logicaloperatortype"},"LogicalOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"LogicalOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$and"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$or"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$not"')),(0,r.kt)("p",null,"List of Logical operators."),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L58"},"query/interface/query.types.ts:58")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"logicalwhereexpr"},"LogicalWhereExpr"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"LogicalWhereExpr"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",": ",(0,r.kt)("inlineCode",{parentName:"p"},"CollectionRangePredicateType")," ","|"," { ","[key in LogicalOperatorType]","?: (FieldWhereExpr"," ","|"," CollectionRangePredicateType)[] } ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"FieldWhereExpr"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">"),(0,r.kt)("p",null,"Structure of Logical WHERE expression"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{ field: { operator: value } } -> e.g { $or: [{ address: { $like: '%ottoman%' } }] }\n")),(0,r.kt)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L164"},"query/interface/query.types.ts:164")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"modeltypes"},"ModelTypes"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ModelTypes"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">",": ",(0,r.kt)("inlineCode",{parentName:"p"},"WhateverTypes")," & ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IModel"},(0,r.kt)("inlineCode",{parentName:"a"},"IModel")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"," & (",(0,r.kt)("inlineCode",{parentName:"p"},"data"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CastOptions"),") => ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">"),(0,r.kt)("h4",{id:"type-parameters-2"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/model.types.ts#L35"},"model/model.types.ts:35")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"mutationfunctionoptions"},"MutationFunctionOptions"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"MutationFunctionOptions"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Object")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Desc"))),(0,r.kt)("p",null,"Used by the mutation functions to apply the defined strategy."),(0,r.kt)("h4",{id:"type-declaration"},"Type declaration"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"enforceRefCheck?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},'"throw"'))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"maxExpiry?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ApplyStrategy"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"transactionContext?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"TransactionAttemptContext"))))),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/cast-strategy.ts#L51"},"utils/cast-strategy.ts:51")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"resultexprtype"},"ResultExprType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ResultExprType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$raw"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$element"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$value"')),(0,r.kt)("p",null,"Result expressions of RAW | ELEMENT | VALUE type."),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L9"},"query/interface/query.types.ts:9")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"returnresulttype"},"ReturnResultType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ReturnResultType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$all"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$distinct"')),(0,r.kt)("p",null,"Result expressions of ALL | DISTINCT type."),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L5"},"query/interface/query.types.ts:5")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sorttype"},"SortType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"SortType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"ASC"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"DESC"')),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/interface/query.types.ts#L1"},"query/interface/query.types.ts:1")),(0,r.kt)("h2",{id:"variables"},"Variables"),(0,r.kt)("h3",{id:"aggdict"},"AggDict"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Const")," ",(0,r.kt)("strong",{parentName:"p"},"AggDict"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#aggtype"},(0,r.kt)("inlineCode",{parentName:"a"},"AggType")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),">"),(0,r.kt)("p",null,"Dictionary for handling aggregation functions."),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/helpers/dictionary.ts#L18"},"query/helpers/dictionary.ts:18")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"resultexprdict"},"ResultExprDict"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Const")," ",(0,r.kt)("strong",{parentName:"p"},"ResultExprDict"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#resultexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"ResultExprType")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),">"),(0,r.kt)("p",null,"Dictionary for handling result expressions of RAW | ELEMENT | VALUE type."),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/helpers/dictionary.ts#L41"},"query/helpers/dictionary.ts:41")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"returnresultdict"},"ReturnResultDict"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Const")," ",(0,r.kt)("strong",{parentName:"p"},"ReturnResultDict"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#returnresulttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ReturnResultType")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),">"),(0,r.kt)("p",null,"Dictionary for handling result expressions of ALL | DISTINCT type."),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/helpers/dictionary.ts#L46"},"query/helpers/dictionary.ts:46")),(0,r.kt)("h2",{id:"functions"},"Functions"),(0,r.kt)("h3",{id:"addvalidators"},"addValidators"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"addValidators"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"validators"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Register custom validators to Schema validators register."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Function"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,"Error"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"}," addValidators({\n email: (value) => {\n regexp = new RegExp(/^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/);\n if (!regexp.test(value)) {\n throw new Error('Email address is invalid.')\n }\n }\n });\n\n const ContactSchema = new Schema({\n name: String,\n contact: { type: String, validator: 'email' }\n });\n")),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"validators")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CustomValidations"))))),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/helpers/fn-schema.ts#L240"},"schema/helpers/fn-schema.ts:240")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"applydefaultvalue"},"applyDefaultValue"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"applyDefaultValue"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"obj"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Apply default values defined on schema to an object instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = { name: { type: String, default: 'John' }, hasChild: { type: Boolean, default: true } };\n const obj: any = applyDefaultValue(obj, schema)\n\n console.log(obj);\n")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"obj")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},"reference to object instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"SchemaDef")),(0,r.kt)("td",{parentName:"tr",align:"left"},"definition will be used to determine default definitions")))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/helpers/fn-schema.ts#L196"},"schema/helpers/fn-schema.ts:196")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"buildindexexpr"},"buildIndexExpr"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildIndexExpr"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collection"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"type"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"on?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"where?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"usingGSI?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"withExpr?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Build a INDEX N1QL query from user-specified parameters.\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/6.5/n1ql/n1ql-language-reference/createindex.html"},"https://docs.couchbase.com/server/6.5/n1ql/n1ql-language-reference/createindex.html")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collection")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Collection name")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#indextype"},(0,r.kt)("inlineCode",{parentName:"a"},"IndexType"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"INDEX clause types ('CREATE' ","|"," 'BUILD' ","|"," 'DROP' ","|"," 'CREATE PRIMARY')")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"on?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IIndexOnParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexOnParams")),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},"ON Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"where?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"WHERE Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"usingGSI?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},"use a Global Secondary Index (GSI)")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"withExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IIndexWithParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexWithParams"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"WITH Clause")))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"N1QL INDEX Query"),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/helpers/builders.ts#L537"},"query/helpers/builders.ts:537")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"buildselectexpr"},"buildSelectExpr"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildSelectExpr"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"n1ql"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"clause"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Recursive function to create N1QL queries."),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"n1ql")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"N1QL Query String")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"clause")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"SELECT Clause")))),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"N1QL SELECT Query"),(0,r.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/helpers/builders.ts#L135"},"query/helpers/builders.ts:135")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"buildwhereclauseexpr"},"buildWhereClauseExpr"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildWhereClauseExpr"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"n1ql"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"clause"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"ignoreCase?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Recursive function to create WHERE N1QL expressions."),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"n1ql")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined")),(0,r.kt)("td",{parentName:"tr",align:"left"},"N1QL Query String")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"clause")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined")),(0,r.kt)("td",{parentName:"tr",align:"left"},"WHERE Clause param")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ignoreCase")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"false")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Apply ignoreCase")))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"N1QL WHERE expression"),(0,r.kt)("h4",{id:"defined-in-25"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/helpers/builders.ts#L302"},"query/helpers/builders.ts:302")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"close"},"close"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"close"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-26"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L583"},"ottoman/ottoman.ts:583")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"connect"},"connect"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"connect"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"connectOptions"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"connectOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"ConnectOptions"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-27"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L577"},"ottoman/ottoman.ts:577")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getcollection"},"getCollection"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getCollection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collectionName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Collection")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collectionName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DEFAULT_COLLECTION"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DEFAULT_SCOPE"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Collection")),(0,r.kt)("h4",{id:"defined-in-28"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L590"},"ottoman/ottoman.ts:590")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getdefaultinstance"},"getDefaultInstance"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getDefaultInstance"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman"))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman"))),(0,r.kt)("h4",{id:"defined-in-29"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L575"},"ottoman/ottoman.ts:575")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getmodel"},"getModel"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getModel"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-30"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L589"},"ottoman/ottoman.ts:589")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getmodelmetadata"},"getModelMetadata"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getModelMetadata"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"modelConstructor"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"ModelMetadata")),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"modelConstructor")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"ModelMetadata")),(0,r.kt)("h4",{id:"defined-in-31"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/utils/model.utils.ts#L19"},"model/utils/model.utils.ts:19")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getottomaninstances"},"getOttomanInstances"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getOttomanInstances"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),"[]"),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),"[]"),(0,r.kt)("h4",{id:"defined-in-32"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L576"},"ottoman/ottoman.ts:576")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getprojectionfields"},"getProjectionFields"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getProjectionFields"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"selectDot"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"select?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"modelKey?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Object")),(0,r.kt)("h4",{id:"parameters-9"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"selectDot")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"select")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[] ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"''"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"{}"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options.noCollection?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"modelKey")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"MODEL_KEY"))))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Object")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fields")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"projection")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"defined-in-33"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/query/extract-select.ts#L23"},"utils/query/extract-select.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getvaluebypath"},"getValueByPath"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getValueByPath"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"obj"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"path"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"type-parameters-3"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">")))),(0,r.kt)("h4",{id:"parameters-10"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"obj")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"path")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-34"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/getValueByPath.ts#L3"},"utils/getValueByPath.ts:3")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"is"},"is"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"is"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"type"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Checking if a value is a specific type or constructor"),(0,r.kt)("h4",{id:"parameters-11"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-35"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/is-type.ts#L8"},"utils/is-type.ts:8")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isdocumentnotfounderror"},"isDocumentNotFoundError"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isDocumentNotFoundError"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"exception"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Return a boolean value if an exception is DocumentNotFoundError."),(0,r.kt)("h4",{id:"parameters-12"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"exception")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-36"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/is-not-found.ts#L6"},"utils/is-not-found.ts:6")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isschemafactorytype"},"isSchemaFactoryType"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isSchemaFactoryType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"factory"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Checking if a value is a factory supported by Ottoman."),(0,r.kt)("h4",{id:"parameters-13"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"factory")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},"List of Schema Factories")))),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-37"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/is-type.ts#L24"},"utils/is-type.ts:24")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isschematypesupported"},"isSchemaTypeSupported"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isSchemaTypeSupported"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Checking if a value is a type supported by Ottoman."),(0,r.kt)("h4",{id:"parameters-14"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-38"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/is-type.ts#L15"},"utils/is-type.ts:15")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"model"},"model"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"model"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"type-parameters-4"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-15"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"unknown"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/ModelOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelOptions")))))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"defined-in-39"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L592"},"ottoman/ottoman.ts:592")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"parsestringselectexpr"},"parseStringSelectExpr"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"parseStringSelectExpr"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"expr"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,r.kt)("p",null,"Convert select expression into an Array of selection keys"),(0,r.kt)("h4",{id:"parameters-16"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"expr")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,r.kt)("h4",{id:"defined-in-40"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/utils.ts#L20"},"query/utils.ts:20")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"registerglobalplugin"},"registerGlobalPlugin"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"registerGlobalPlugin"),"(...",(0,r.kt)("inlineCode",{parentName:"p"},"plugins"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Register a global plugin."),(0,r.kt)("h4",{id:"parameters-17"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"...plugins")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"),"[]")))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-41"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/plugins/global-plugin-handler.ts#L13"},"plugins/global-plugin-handler.ts:13")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"registertype"},"registerType"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"registerType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"factory"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Register a custom type to Schema supported types."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Function"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,"Error"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"}," registerType(Int8.name, (fieldName, opts) => new Int8(fieldName, opts.required));\n")),(0,r.kt)("h4",{id:"parameters-18"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"factory")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"FactoryFunction"))))),(0,r.kt)("h4",{id:"returns-21"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-42"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/helpers/fn-schema.ts#L211"},"schema/helpers/fn-schema.ts:211")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"searchquery"},"searchQuery"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"searchQuery"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"indexName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"StreamableRowPromise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchResult"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchRow"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchMetaData"),">"),(0,r.kt)("h4",{id:"parameters-19"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"indexName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"SearchQuery"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"SearchQueryOptions"))))),(0,r.kt)("h4",{id:"returns-22"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"StreamableRowPromise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchResult"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchRow"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchMetaData"),">"),(0,r.kt)("h4",{id:"defined-in-43"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L598"},"ottoman/ottoman.ts:598")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"selectbuilder"},"selectBuilder"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"selectBuilder"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collection"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"select"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"letExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"where?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"orderBy?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"limit?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"offset?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"useExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"groupByExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"lettingExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"havingExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"plainJoinExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"ignoreCase?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Build a SELECT N1QL query from user-specified parameters.\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/6.5/n1ql/n1ql-language-reference/select-syntax.html"},"https://docs.couchbase.com/server/6.5/n1ql/n1ql-language-reference/select-syntax.html")),(0,r.kt)("h4",{id:"parameters-20"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collection")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Collection name")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"select")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},"SELECT Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"letExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"LET Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"where?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"WHERE Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"orderBy?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#sorttype"},(0,r.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"ORDER BY Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"limit?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number")),(0,r.kt)("td",{parentName:"tr",align:"left"},"LIMIT Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"offset?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number")),(0,r.kt)("td",{parentName:"tr",align:"left"},"OFFSET Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"useExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},"USE Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"groupByExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"IGroupBy"),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},"GROUP BY Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"lettingExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"LETTING Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"havingExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"HAVING Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"plainJoinExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"PLAIN JOIN string definition")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ignoreCase?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},"boolean to ignore case")))),(0,r.kt)("h4",{id:"returns-23"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"N1QL SELECT Query"),(0,r.kt)("h4",{id:"defined-in-44"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/helpers/builders.ts#L62"},"query/helpers/builders.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"set"},"set"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"set"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"key"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-21"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"key")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"boolean"))))),(0,r.kt)("h4",{id:"returns-24"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-45"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/environment-set.ts#L3"},"utils/environment-set.ts:3")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"setvaluebypath"},"setValueByPath"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"setValueByPath"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"object"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"path"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"type-parameters-5"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">")))),(0,r.kt)("h4",{id:"parameters-22"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"object")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"path")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-25"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-46"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/utils/setValueByPath.ts#L3"},"utils/setValueByPath.ts:3")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"start"},"start"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"start"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"returns-26"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-47"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/ottoman/ottoman.ts#L588"},"ottoman/ottoman.ts:588")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Validate data using the schema definition."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,"BuildSchemaError, ValidationError"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},' const data = {\n name: "John",\n age: "50"\n };\n const schema = new Schema({\n name: String,\n age: {type: Number, intVal: true}\n });\n const strictSchema = new Schema({\n name: String,\n age: {type: Number, intVal: true}\n },\n {\n validationStrategy: VALIDATION_STRATEGY.STRICT\n });\n console.log(castSchema(data, schema)); // Print { name: "John", age: 50 }\n console.log(castSchema(data, strictSchema)); // Throw "Property age must be of type Number"\n')),(0,r.kt)("h4",{id:"parameters-23"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},"that is going to be validated")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"SchemaDef")),(0,r.kt)("td",{parentName:"tr",align:"left"},"that will be used to validate")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CastOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"})))),(0,r.kt)("h4",{id:"returns-27"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-48"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/helpers/fn-schema.ts#L152"},"schema/helpers/fn-schema.ts:152")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f6aebfbf.d9ebfc5a.js b/assets/js/f6aebfbf.d9ebfc5a.js deleted file mode 100644 index 52551fe0..00000000 --- a/assets/js/f6aebfbf.d9ebfc5a.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[7306],{3905:(e,t,a)=>{a.d(t,{Zo:()=>m,kt:()=>u});var n=a(7294);function r(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function l(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function i(e){for(var t=1;t=0||(r[a]=e[a]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(r[a]=e[a])}return r}var d=n.createContext({}),o=function(e){var t=n.useContext(d),a=t;return e&&(a="function"==typeof e?e(t):i(i({},t),e)),a},m=function(e){var t=o(e.components);return n.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},k=n.forwardRef((function(e,t){var a=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,m=p(e,["components","mdxType","originalType","parentName"]),k=o(a),u=r,N=k["".concat(d,".").concat(u)]||k[u]||s[u]||l;return a?n.createElement(N,i(i({ref:t},m),{},{components:a})):n.createElement(N,i({ref:t},m))}));function u(e,t){var a=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=a.length,i=new Array(l);i[0]=k;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var o=2;o{a.r(t),a.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>s,frontMatter:()=>l,metadata:()=>p,toc:()=>o});var n=a(7462),r=(a(7294),a(3905));const l={id:"modules",title:"ottoman",sidebar_label:"Exports",sidebar_position:.5,custom_edit_url:null},i=void 0,p={unversionedId:"api/modules",id:"api/modules",title:"ottoman",description:"Enumerations",source:"@site/docs/api/modules.md",sourceDirName:"api",slug:"/api/modules",permalink:"/docs/api/modules",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:.5,frontMatter:{id:"modules",title:"ottoman",sidebar_label:"Exports",sidebar_position:.5,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Readme",permalink:"/docs/api/"},next:{title:"SearchConsistency",permalink:"/docs/api/enums/SearchConsistency"}},d={},o=[{value:"Enumerations",id:"enumerations",level:2},{value:"Classes",id:"classes",level:2},{value:"Interfaces",id:"interfaces",level:2},{value:"Type Aliases",id:"type-aliases",level:2},{value:"AggType",id:"aggtype",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"ComparisonEmptyOperatorType",id:"comparisonemptyoperatortype",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"ComparisonMultipleOperatorType",id:"comparisonmultipleoperatortype",level:3},{value:"Defined in",id:"defined-in-2",level:4},{value:"ComparisonSingleOperatorType",id:"comparisonsingleoperatortype",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"ComparisonSingleStringOperatorType",id:"comparisonsinglestringoperatortype",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"ComparisonWhereExpr",id:"comparisonwhereexpr",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"IDocument",id:"idocument",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:"Defined in",id:"defined-in-6",level:4},{value:"ISelectAggType",id:"iselectaggtype",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"ISelectType",id:"iselecttype",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"IndexType",id:"indextype",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"LetExprType",id:"letexprtype",level:3},{value:"Defined in",id:"defined-in-10",level:4},{value:"LogicalOperatorType",id:"logicaloperatortype",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"LogicalWhereExpr",id:"logicalwhereexpr",level:3},{value:"Type parameters",id:"type-parameters-1",level:4},{value:"Defined in",id:"defined-in-12",level:4},{value:"ModelTypes",id:"modeltypes",level:3},{value:"Type parameters",id:"type-parameters-2",level:4},{value:"Defined in",id:"defined-in-13",level:4},{value:"MutationFunctionOptions",id:"mutationfunctionoptions",level:3},{value:"Type declaration",id:"type-declaration",level:4},{value:"Defined in",id:"defined-in-14",level:4},{value:"ResultExprType",id:"resultexprtype",level:3},{value:"Defined in",id:"defined-in-15",level:4},{value:"ReturnResultType",id:"returnresulttype",level:3},{value:"Defined in",id:"defined-in-16",level:4},{value:"SortType",id:"sorttype",level:3},{value:"Defined in",id:"defined-in-17",level:4},{value:"Variables",id:"variables",level:2},{value:"AggDict",id:"aggdict",level:3},{value:"Defined in",id:"defined-in-18",level:4},{value:"ResultExprDict",id:"resultexprdict",level:3},{value:"Defined in",id:"defined-in-19",level:4},{value:"ReturnResultDict",id:"returnresultdict",level:3},{value:"Defined in",id:"defined-in-20",level:4},{value:"Functions",id:"functions",level:2},{value:"addValidators",id:"addvalidators",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"applyDefaultValue",id:"applydefaultvalue",level:3},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"buildIndexExpr",id:"buildindexexpr",level:3},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"buildSelectExpr",id:"buildselectexpr",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-24",level:4},{value:"buildWhereClauseExpr",id:"buildwhereclauseexpr",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Defined in",id:"defined-in-25",level:4},{value:"close",id:"close",level:3},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-26",level:4},{value:"connect",id:"connect",level:3},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-27",level:4},{value:"getCollection",id:"getcollection",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-28",level:4},{value:"getDefaultInstance",id:"getdefaultinstance",level:3},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-29",level:4},{value:"getModel",id:"getmodel",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-30",level:4},{value:"getModelMetadata",id:"getmodelmetadata",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Defined in",id:"defined-in-31",level:4},{value:"getOttomanInstances",id:"getottomaninstances",level:3},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-32",level:4},{value:"getProjectionFields",id:"getprojectionfields",level:3},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Defined in",id:"defined-in-33",level:4},{value:"getValueByPath",id:"getvaluebypath",level:3},{value:"Type parameters",id:"type-parameters-3",level:4},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Defined in",id:"defined-in-34",level:4},{value:"is",id:"is",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-14",level:4},{value:"Defined in",id:"defined-in-35",level:4},{value:"isDocumentNotFoundError",id:"isdocumentnotfounderror",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-15",level:4},{value:"Defined in",id:"defined-in-36",level:4},{value:"isSchemaFactoryType",id:"isschemafactorytype",level:3},{value:"Parameters",id:"parameters-13",level:4},{value:"Returns",id:"returns-16",level:4},{value:"Defined in",id:"defined-in-37",level:4},{value:"isSchemaTypeSupported",id:"isschematypesupported",level:3},{value:"Parameters",id:"parameters-14",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Defined in",id:"defined-in-38",level:4},{value:"model",id:"model",level:3},{value:"Type parameters",id:"type-parameters-4",level:4},{value:"Parameters",id:"parameters-15",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Defined in",id:"defined-in-39",level:4},{value:"parseStringSelectExpr",id:"parsestringselectexpr",level:3},{value:"Parameters",id:"parameters-16",level:4},{value:"Returns",id:"returns-19",level:4},{value:"Defined in",id:"defined-in-40",level:4},{value:"registerGlobalPlugin",id:"registerglobalplugin",level:3},{value:"Parameters",id:"parameters-17",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Defined in",id:"defined-in-41",level:4},{value:"registerType",id:"registertype",level:3},{value:"Parameters",id:"parameters-18",level:4},{value:"Returns",id:"returns-21",level:4},{value:"Defined in",id:"defined-in-42",level:4},{value:"searchQuery",id:"searchquery",level:3},{value:"Parameters",id:"parameters-19",level:4},{value:"Returns",id:"returns-22",level:4},{value:"Defined in",id:"defined-in-43",level:4},{value:"selectBuilder",id:"selectbuilder",level:3},{value:"Parameters",id:"parameters-20",level:4},{value:"Returns",id:"returns-23",level:4},{value:"Defined in",id:"defined-in-44",level:4},{value:"set",id:"set",level:3},{value:"Parameters",id:"parameters-21",level:4},{value:"Returns",id:"returns-24",level:4},{value:"Defined in",id:"defined-in-45",level:4},{value:"setValueByPath",id:"setvaluebypath",level:3},{value:"Type parameters",id:"type-parameters-5",level:4},{value:"Parameters",id:"parameters-22",level:4},{value:"Returns",id:"returns-25",level:4},{value:"Defined in",id:"defined-in-46",level:4},{value:"start",id:"start",level:3},{value:"Returns",id:"returns-26",level:4},{value:"Defined in",id:"defined-in-47",level:4},{value:"validate",id:"validate",level:3},{value:"Parameters",id:"parameters-23",level:4},{value:"Returns",id:"returns-27",level:4},{value:"Defined in",id:"defined-in-48",level:4}],m={toc:o};function s(e){let{components:t,...a}=e;return(0,r.kt)("wrapper",(0,n.Z)({},m,a,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"enumerations"},"Enumerations"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/enums/SearchConsistency"},"SearchConsistency")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/enums/VALIDATION_STRATEGY"},"VALIDATION","_","STRATEGY"))),(0,r.kt)("h2",{id:"classes"},"Classes"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ArrayType"},"ArrayType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/BooleanType"},"BooleanType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/BuildSchemaError"},"BuildSchemaError")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/CoreType"},"CoreType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/DateType"},"DateType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Document"},"Document")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/EmbedType"},"EmbedType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/FindByIdOptions"},"FindByIdOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/FindOptions"},"FindOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/IOttomanType"},"IOttomanType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/IndexParamsOnExceptions"},"IndexParamsOnExceptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/IndexParamsUsingGSIExceptions"},"IndexParamsUsingGSIExceptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ManyQueryResponse"},"ManyQueryResponse")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/MixedType"},"MixedType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Model"},"Model")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/MultipleQueryTypesException"},"MultipleQueryTypesException")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/NumberType"},"NumberType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Ottoman"},"Ottoman")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Query"},"Query")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/QueryGroupByParamsException"},"QueryGroupByParamsException")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/QueryOperatorNotFoundException"},"QueryOperatorNotFoundException")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ReferenceType"},"ReferenceType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/Schema"},"Schema")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/SelectClauseException"},"SelectClauseException")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/StringType"},"StringType")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ValidationError"},"ValidationError")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/ViewIndexOptions"},"ViewIndexOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/classes/WhereClauseException"},"WhereClauseException"))),(0,r.kt)("h2",{id:"interfaces"},"Interfaces"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/CreateModelOptions"},"CreateModelOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/FindOneAndUpdateOption"},"FindOneAndUpdateOption")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IConditionExpr"},"IConditionExpr")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IField"},"IField")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IIndexOnParams"},"IIndexOnParams")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IIndexWithParams"},"IIndexWithParams")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IManyQueryResponse"},"IManyQueryResponse")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IModel"},"IModel")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/IStatusExecution"},"IStatusExecution")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/ModelOptions"},"ModelOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/UpdateManyOptions"},"UpdateManyOptions")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/ValidatorOption"},"ValidatorOption")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/api/interfaces/saveOptions"},"saveOptions"))),(0,r.kt)("h2",{id:"type-aliases"},"Type Aliases"),(0,r.kt)("h3",{id:"aggtype"},"AggType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"AggType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$arrayAgg"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$avg"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$mean"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$count"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$countn"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$max"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$median"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$min"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$stddev"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$stddevPop"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$stddevSamp"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$sum"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$variance"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$variancePop"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$varianceSamp"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$varPop"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$varSamp"')),(0,r.kt)("p",null,"List of aggregation functions."),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L13"},"query/interface/query.types.ts:13")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonemptyoperatortype"},"ComparisonEmptyOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonEmptyOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isNull"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isNotNull"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isMissing"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isNotMissing"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isValued"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$isNotValued"')),(0,r.kt)("p",null,"List of Boolean comparison operators."),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L35"},"query/interface/query.types.ts:35")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonmultipleoperatortype"},"ComparisonMultipleOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonMultipleOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$btw"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$notBtw"')),(0,r.kt)("p",null,"List of Range comparison operators."),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L53"},"query/interface/query.types.ts:53")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonsingleoperatortype"},"ComparisonSingleOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonSingleOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$eq"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$neq"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$gt"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$gte"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$lt"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$lte"')),(0,r.kt)("p",null,"List of Numeric comparison operators."),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L45"},"query/interface/query.types.ts:45")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonsinglestringoperatortype"},"ComparisonSingleStringOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonSingleStringOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$like"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$notLike"')),(0,r.kt)("p",null,"List of String comparison operators."),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L49"},"query/interface/query.types.ts:49")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"comparisonwhereexpr"},"ComparisonWhereExpr"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ComparisonWhereExpr"),": { ","[key in ComparisonEmptyOperatorType ","|"," ComparisonSingleOperatorType ","|"," ComparisonMultipleOperatorType ","|"," ComparisonSingleStringOperatorType]","?: string ","|"," number ","|"," boolean ","|"," (number ","|"," string)[] } ","|"," { ","[key in CollectionDeepSearchOperatorType]","?: string ","|"," any[] }"),(0,r.kt)("p",null,"Structure of the comparison operators."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{ operator: value } -> e.g { $like: '%ottoman%' }\n")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L129"},"query/interface/query.types.ts:129")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"idocument"},"IDocument"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"IDocument"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",": ",(0,r.kt)("inlineCode",{parentName:"p"},"CleanDocument")," & ",(0,r.kt)("inlineCode",{parentName:"p"},"T")),(0,r.kt)("h4",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/document.ts#L21"},"model/document.ts:21")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"iselectaggtype"},"ISelectAggType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ISelectAggType"),": { ","[key in AggType]","?: ISelectFieldType }"),(0,r.kt)("p",null,"SELECT aggregation expression"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," { $count: { $field: { name: 'address' }, as: 'addr' } } | { $count: { $field: 'address' } }\n")),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L194"},"query/interface/query.types.ts:194")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"iselecttype"},"ISelectType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ISelectType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ISelectReturnResultType")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ISelectResultExprType")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#iselectaggtype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectAggType"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"ISelectFieldType")),(0,r.kt)("p",null,"SELECT expression"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"}," { $all: { $field: { name: 'address' }, as: 'addr' }, $field: 'type', $field: { name: 'count' } }\n")),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L246"},"query/interface/query.types.ts:246")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indextype"},"IndexType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"IndexType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"CREATE"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"BUILD"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"DROP"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"CREATE PRIMARY"')),(0,r.kt)("p",null,"Types of supported index statements"),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L277"},"query/interface/query.types.ts:277")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"letexprtype"},"LetExprType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"LetExprType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"unknown"),">"),(0,r.kt)("p",null,"LET expression"),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L251"},"query/interface/query.types.ts:251")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"logicaloperatortype"},"LogicalOperatorType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"LogicalOperatorType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$and"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$or"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$not"')),(0,r.kt)("p",null,"List of Logical operators."),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L58"},"query/interface/query.types.ts:58")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"logicalwhereexpr"},"LogicalWhereExpr"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"LogicalWhereExpr"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">",": ",(0,r.kt)("inlineCode",{parentName:"p"},"CollectionRangePredicateType")," ","|"," { ","[key in LogicalOperatorType]","?: (FieldWhereExpr"," ","|"," CollectionRangePredicateType)[] } ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"FieldWhereExpr"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">"),(0,r.kt)("p",null,"Structure of Logical WHERE expression"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"{ field: { operator: value } } -> e.g { $or: [{ address: { $like: '%ottoman%' } }] }\n")),(0,r.kt)("h4",{id:"type-parameters-1"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L164"},"query/interface/query.types.ts:164")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"modeltypes"},"ModelTypes"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ModelTypes"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">",": ",(0,r.kt)("inlineCode",{parentName:"p"},"WhateverTypes")," & ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IModel"},(0,r.kt)("inlineCode",{parentName:"a"},"IModel")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"," & (",(0,r.kt)("inlineCode",{parentName:"p"},"data"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"CastOptions"),") => ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#idocument"},(0,r.kt)("inlineCode",{parentName:"a"},"IDocument")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">"),(0,r.kt)("h4",{id:"type-parameters-2"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/model.types.ts#L19"},"model/model.types.ts:19")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"mutationfunctionoptions"},"MutationFunctionOptions"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"MutationFunctionOptions"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Object")),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Desc"))),(0,r.kt)("p",null,"Used by the mutation functions to apply the defined strategy."),(0,r.kt)("h4",{id:"type-declaration"},"Type declaration"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"enforceRefCheck?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},'"throw"'))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"maxExpiry?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"strict?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ApplyStrategy"))))),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/cast-strategy.ts#L50"},"utils/cast-strategy.ts:50")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"resultexprtype"},"ResultExprType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ResultExprType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$raw"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$element"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$value"')),(0,r.kt)("p",null,"Result expressions of RAW | ELEMENT | VALUE type."),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L9"},"query/interface/query.types.ts:9")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"returnresulttype"},"ReturnResultType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"ReturnResultType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"$all"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"$distinct"')),(0,r.kt)("p",null,"Result expressions of ALL | DISTINCT type."),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L5"},"query/interface/query.types.ts:5")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"sorttype"},"SortType"),(0,r.kt)("p",null,"\u01ac ",(0,r.kt)("strong",{parentName:"p"},"SortType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"ASC"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"DESC"')),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/interface/query.types.ts#L1"},"query/interface/query.types.ts:1")),(0,r.kt)("h2",{id:"variables"},"Variables"),(0,r.kt)("h3",{id:"aggdict"},"AggDict"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Const")," ",(0,r.kt)("strong",{parentName:"p"},"AggDict"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#aggtype"},(0,r.kt)("inlineCode",{parentName:"a"},"AggType")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),">"),(0,r.kt)("p",null,"Dictionary for handling aggregation functions."),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/helpers/dictionary.ts#L18"},"query/helpers/dictionary.ts:18")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"resultexprdict"},"ResultExprDict"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Const")," ",(0,r.kt)("strong",{parentName:"p"},"ResultExprDict"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#resultexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"ResultExprType")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),">"),(0,r.kt)("p",null,"Dictionary for handling result expressions of RAW | ELEMENT | VALUE type."),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/helpers/dictionary.ts#L41"},"query/helpers/dictionary.ts:41")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"returnresultdict"},"ReturnResultDict"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Const")," ",(0,r.kt)("strong",{parentName:"p"},"ReturnResultDict"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#returnresulttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ReturnResultType")),", ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),">"),(0,r.kt)("p",null,"Dictionary for handling result expressions of ALL | DISTINCT type."),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/helpers/dictionary.ts#L46"},"query/helpers/dictionary.ts:46")),(0,r.kt)("h2",{id:"functions"},"Functions"),(0,r.kt)("h3",{id:"addvalidators"},"addValidators"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"addValidators"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"validators"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Register custom validators to Schema validators register."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Function"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,"Error"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"}," addValidators({\n email: (value) => {\n regexp = new RegExp(/^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$/);\n if (!regexp.test(value)) {\n throw new Error('Email address is invalid.')\n }\n }\n });\n\n const ContactSchema = new Schema({\n name: String,\n contact: { type: String, validator: 'email' }\n });\n")),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"validators")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CustomValidations"))))),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/helpers/fn-schema.ts#L240"},"schema/helpers/fn-schema.ts:240")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"applydefaultvalue"},"applyDefaultValue"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"applyDefaultValue"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"obj"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Apply default values defined on schema to an object instance."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"}," const schema = { name: { type: String, default: 'John' }, hasChild: { type: Boolean, default: true } };\n const obj: any = applyDefaultValue(obj, schema)\n\n console.log(obj);\n")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"obj")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},"reference to object instance")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"SchemaDef")),(0,r.kt)("td",{parentName:"tr",align:"left"},"definition will be used to determine default definitions")))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/helpers/fn-schema.ts#L196"},"schema/helpers/fn-schema.ts:196")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"buildindexexpr"},"buildIndexExpr"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildIndexExpr"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collection"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"type"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"on?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"where?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"usingGSI?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"withExpr?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Build a INDEX N1QL query from user-specified parameters.\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/6.5/n1ql/n1ql-language-reference/createindex.html"},"https://docs.couchbase.com/server/6.5/n1ql/n1ql-language-reference/createindex.html")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collection")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Collection name")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#indextype"},(0,r.kt)("inlineCode",{parentName:"a"},"IndexType"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"INDEX clause types ('CREATE' ","|"," 'BUILD' ","|"," 'DROP' ","|"," 'CREATE PRIMARY')")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"-")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"on?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IIndexOnParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexOnParams")),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},"ON Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"where?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"WHERE Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"usingGSI?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},"use a Global Secondary Index (GSI)")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"withExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IIndexWithParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexWithParams"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"WITH Clause")))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"N1QL INDEX Query"),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/helpers/builders.ts#L537"},"query/helpers/builders.ts:537")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"buildselectexpr"},"buildSelectExpr"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildSelectExpr"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"n1ql"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"clause"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Recursive function to create N1QL queries."),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"n1ql")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"N1QL Query String")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"clause")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"SELECT Clause")))),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"N1QL SELECT Query"),(0,r.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/helpers/builders.ts#L135"},"query/helpers/builders.ts:135")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"buildwhereclauseexpr"},"buildWhereClauseExpr"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"buildWhereClauseExpr"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"n1ql"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"clause"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"ignoreCase?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Recursive function to create WHERE N1QL expressions."),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"n1ql")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined")),(0,r.kt)("td",{parentName:"tr",align:"left"},"N1QL Query String")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"clause")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined")),(0,r.kt)("td",{parentName:"tr",align:"left"},"WHERE Clause param")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ignoreCase")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"false")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Apply ignoreCase")))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"N1QL WHERE expression"),(0,r.kt)("h4",{id:"defined-in-25"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/helpers/builders.ts#L302"},"query/helpers/builders.ts:302")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"close"},"close"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"close"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-26"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L548"},"ottoman/ottoman.ts:548")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"connect"},"connect"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"connect"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"connectOptions"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"connectOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"ConnectOptions"))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-27"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L542"},"ottoman/ottoman.ts:542")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getcollection"},"getCollection"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getCollection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collectionName?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"scopeName?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Collection")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collectionName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DEFAULT_COLLECTION"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"scopeName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"DEFAULT_SCOPE"))))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Collection")),(0,r.kt)("h4",{id:"defined-in-28"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L555"},"ottoman/ottoman.ts:555")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getdefaultinstance"},"getDefaultInstance"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getDefaultInstance"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman"))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman"))),(0,r.kt)("h4",{id:"defined-in-29"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L540"},"ottoman/ottoman.ts:540")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getmodel"},"getModel"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getModel"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("h4",{id:"defined-in-30"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L554"},"ottoman/ottoman.ts:554")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getmodelmetadata"},"getModelMetadata"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getModelMetadata"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"modelConstructor"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"ModelMetadata")),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"modelConstructor")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-10"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"ModelMetadata")),(0,r.kt)("h4",{id:"defined-in-31"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/utils/model.utils.ts#L19"},"model/utils/model.utils.ts:19")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getottomaninstances"},"getOttomanInstances"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getOttomanInstances"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),"[]"),(0,r.kt)("h4",{id:"returns-11"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")),"[]"),(0,r.kt)("h4",{id:"defined-in-32"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L541"},"ottoman/ottoman.ts:541")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getprojectionfields"},"getProjectionFields"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getProjectionFields"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"selectDot"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"select?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"modelKey?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Object")),(0,r.kt)("h4",{id:"parameters-9"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Default value"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"selectDot")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"select")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[] ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"''"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"{}"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options.noCollection?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"undefined"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"modelKey")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"MODEL_KEY"))))),(0,r.kt)("h4",{id:"returns-12"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Object")),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"fields")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"projection")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"defined-in-33"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/query/extract-select.ts#L23"},"utils/query/extract-select.ts:23")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"getvaluebypath"},"getValueByPath"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"getValueByPath"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"obj"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"path"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"type-parameters-3"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">")))),(0,r.kt)("h4",{id:"parameters-10"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"obj")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"path")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-13"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-34"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/getValueByPath.ts#L3"},"utils/getValueByPath.ts:3")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"is"},"is"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"is"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"type"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Checking if a value is a specific type or constructor"),(0,r.kt)("h4",{id:"parameters-11"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-14"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-35"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/is-type.ts#L8"},"utils/is-type.ts:8")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isdocumentnotfounderror"},"isDocumentNotFoundError"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isDocumentNotFoundError"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"exception"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Return a boolean value if an exception is DocumentNotFoundError."),(0,r.kt)("h4",{id:"parameters-12"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"exception")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-36"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/is-not-found.ts#L6"},"utils/is-not-found.ts:6")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isschemafactorytype"},"isSchemaFactoryType"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isSchemaFactoryType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"factory"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Checking if a value is a factory supported by Ottoman."),(0,r.kt)("h4",{id:"parameters-13"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"})),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"factory")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},"List of Schema Factories")))),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-37"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/is-type.ts#L24"},"utils/is-type.ts:24")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"isschematypesupported"},"isSchemaTypeSupported"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"isSchemaTypeSupported"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"val"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"Checking if a value is a type supported by Ottoman."),(0,r.kt)("h4",{id:"parameters-14"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"val")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("h4",{id:"defined-in-38"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/is-type.ts#L15"},"utils/is-type.ts:15")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"model"},"model"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"model"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"type-parameters-4"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"R")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))))),(0,r.kt)("h4",{id:"parameters-15"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"unknown"),">")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/ModelOptions"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelOptions")))))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#modeltypes"},(0,r.kt)("inlineCode",{parentName:"a"},"ModelTypes")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"R"),">"),(0,r.kt)("h4",{id:"defined-in-39"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L557"},"ottoman/ottoman.ts:557")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"parsestringselectexpr"},"parseStringSelectExpr"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"parseStringSelectExpr"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"expr"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,r.kt)("p",null,"Convert select expression into an Array of selection keys"),(0,r.kt)("h4",{id:"parameters-16"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"expr")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,r.kt)("h4",{id:"defined-in-40"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/utils.ts#L20"},"query/utils.ts:20")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"registerglobalplugin"},"registerGlobalPlugin"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"registerGlobalPlugin"),"(...",(0,r.kt)("inlineCode",{parentName:"p"},"plugins"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Register a global plugin."),(0,r.kt)("h4",{id:"parameters-17"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"...plugins")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"),"[]")))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-41"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/plugins/global-plugin-handler.ts#L13"},"plugins/global-plugin-handler.ts:13")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"registertype"},"registerType"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"registerType"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"name"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"factory"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Register a custom type to Schema supported types."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Function"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,"Error"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"}," registerType(Int8.name, (fieldName, opts) => new Int8(fieldName, opts.required));\n")),(0,r.kt)("h4",{id:"parameters-18"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"factory")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"FactoryFunction"))))),(0,r.kt)("h4",{id:"returns-21"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-42"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/helpers/fn-schema.ts#L211"},"schema/helpers/fn-schema.ts:211")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"searchquery"},"searchQuery"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"searchQuery"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"indexName"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"query"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"StreamableRowPromise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchResult"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchRow"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchMetaData"),">"),(0,r.kt)("h4",{id:"parameters-19"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"indexName")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"query")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"SearchQuery"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"SearchQueryOptions"))))),(0,r.kt)("h4",{id:"returns-22"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"StreamableRowPromise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"SearchResult"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchRow"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"SearchMetaData"),">"),(0,r.kt)("h4",{id:"defined-in-43"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L563"},"ottoman/ottoman.ts:563")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"selectbuilder"},"selectBuilder"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"selectBuilder"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"collection"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"select"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"letExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"where?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"orderBy?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"limit?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"offset?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"useExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"groupByExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"lettingExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"havingExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"plainJoinExpr?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"ignoreCase?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Build a SELECT N1QL query from user-specified parameters.\n",(0,r.kt)("a",{parentName:"p",href:"https://docs.couchbase.com/server/6.5/n1ql/n1ql-language-reference/select-syntax.html"},"https://docs.couchbase.com/server/6.5/n1ql/n1ql-language-reference/select-syntax.html")),(0,r.kt)("h4",{id:"parameters-20"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collection")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Collection name")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"select")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},"SELECT Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"letExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"LET Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"where?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"WHERE Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"orderBy?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#sorttype"},(0,r.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"ORDER BY Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"limit?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number")),(0,r.kt)("td",{parentName:"tr",align:"left"},"LIMIT Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"offset?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"number")),(0,r.kt)("td",{parentName:"tr",align:"left"},"OFFSET Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"useExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},"USE Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"groupByExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"IGroupBy"),"[]"),(0,r.kt)("td",{parentName:"tr",align:"left"},"GROUP BY Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"lettingExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"LETTING Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"havingExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">"),(0,r.kt)("td",{parentName:"tr",align:"left"},"HAVING Clause")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"plainJoinExpr?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"PLAIN JOIN string definition")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ignoreCase?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"boolean")),(0,r.kt)("td",{parentName:"tr",align:"left"},"boolean to ignore case")))),(0,r.kt)("h4",{id:"returns-23"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"N1QL SELECT Query"),(0,r.kt)("h4",{id:"defined-in-44"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/helpers/builders.ts#L62"},"query/helpers/builders.ts:62")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"set"},"set"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"set"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"key"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-21"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"key")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"number")," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"boolean"))))),(0,r.kt)("h4",{id:"returns-24"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-45"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/environment-set.ts#L3"},"utils/environment-set.ts:3")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"setvaluebypath"},"setValueByPath"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"setValueByPath"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"T"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"object"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"path"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"type-parameters-5"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"td"},"string"),", ",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">")))),(0,r.kt)("h4",{id:"parameters-22"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"object")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"T"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"path")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"returns-25"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-46"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/utils/setValueByPath.ts#L3"},"utils/setValueByPath.ts:3")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"start"},"start"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"start"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"returns-26"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"void"),">"),(0,r.kt)("h4",{id:"defined-in-47"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/ottoman/ottoman.ts#L553"},"ottoman/ottoman.ts:553")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"validate"},"validate"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"validate"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"data"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"schema"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("p",null,"Validate data using the schema definition."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Throws"))),(0,r.kt)("p",null,"BuildSchemaError, ValidationError"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},' const data = {\n name: "John",\n age: "50"\n };\n const schema = new Schema({\n name: String,\n age: {type: Number, intVal: true}\n });\n const strictSchema = new Schema({\n name: String,\n age: {type: Number, intVal: true}\n },\n {\n validationStrategy: VALIDATION_STRATEGY.STRICT\n });\n console.log(castSchema(data, schema)); // Print { name: "John", age: 50 }\n console.log(castSchema(data, strictSchema)); // Throw "Property age must be of type Number"\n')),(0,r.kt)("h4",{id:"parameters-23"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"data")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any")),(0,r.kt)("td",{parentName:"tr",align:"left"},"that is going to be validated")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"schema")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Schema"},(0,r.kt)("inlineCode",{parentName:"a"},"Schema"))," ","|"," ",(0,r.kt)("inlineCode",{parentName:"td"},"SchemaDef")),(0,r.kt)("td",{parentName:"tr",align:"left"},"that will be used to validate")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"CastOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"})))),(0,r.kt)("h4",{id:"returns-27"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"any")),(0,r.kt)("h4",{id:"defined-in-48"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/helpers/fn-schema.ts#L152"},"schema/helpers/fn-schema.ts:152")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f6e3c820.24f6227c.js b/assets/js/f6e3c820.3f356a2f.js similarity index 95% rename from assets/js/f6e3c820.24f6227c.js rename to assets/js/f6e3c820.3f356a2f.js index d8dd9cd2..1f9d193c 100644 --- a/assets/js/f6e3c820.24f6227c.js +++ b/assets/js/f6e3c820.3f356a2f.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6058],{3905:(e,t,n)=>{n.d(t,{Zo:()=>o,kt:()=>k});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),s=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},o=function(e){var t=s(e.components);return a.createElement(d.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),m=s(n),k=r,N=m["".concat(d,".").concat(k)]||m[k]||u[k]||l;return n?a.createElement(N,i(i({ref:t},o),{},{components:n})):a.createElement(N,i({ref:t},o))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=m;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>p,toc:()=>s});var a=n(7462),r=(n(7294),n(3905));const l={id:"Query",title:"Class: Query",sidebar_label:"Query",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/classes/Query",id:"api/classes/Query",title:"Class: Query",description:"Hierarchy",source:"@site/docs/api/classes/Query.md",sourceDirName:"api/classes",slug:"/api/classes/Query",permalink:"/docs/api/classes/Query",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Query",title:"Class: Query",sidebar_label:"Query",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Ottoman",permalink:"/docs/api/classes/Ottoman"},next:{title:"QueryGroupByParamsException",permalink:"/docs/api/classes/QueryGroupByParamsException"}},d={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"_collection",id:"_collection",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"_conditions",id:"_conditions",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"groupByExpr",id:"groupbyexpr",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"havingExpr",id:"havingexpr",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"indexName",id:"indexname",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"indexOn",id:"indexon",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"indexType",id:"indextype",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"indexUsingGSI",id:"indexusinggsi",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"indexWith",id:"indexwith",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"letExpr",id:"letexpr",level:3},{value:"Defined in",id:"defined-in-10",level:4},{value:"lettingExpr",id:"lettingexpr",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"limitExpr",id:"limitexpr",level:3},{value:"Defined in",id:"defined-in-12",level:4},{value:"offSetExpr",id:"offsetexpr",level:3},{value:"Defined in",id:"defined-in-13",level:4},{value:"orderExpr",id:"orderexpr",level:3},{value:"Defined in",id:"defined-in-14",level:4},{value:"plainJoinExpr",id:"plainjoinexpr",level:3},{value:"Defined in",id:"defined-in-15",level:4},{value:"queryType",id:"querytype",level:3},{value:"Defined in",id:"defined-in-16",level:4},{value:"selectExpr",id:"selectexpr",level:3},{value:"Defined in",id:"defined-in-17",level:4},{value:"useKeysExpr",id:"usekeysexpr",level:3},{value:"Defined in",id:"defined-in-18",level:4},{value:"whereExpr",id:"whereexpr",level:3},{value:"Defined in",id:"defined-in-19",level:4},{value:"Accessors",id:"accessors",level:2},{value:"collection",id:"collection",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"conditions",id:"conditions",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"Methods",id:"methods",level:2},{value:"build",id:"build",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-24",level:4},{value:"compileFromConditions",id:"compilefromconditions",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-25",level:4},{value:"execute",id:"execute",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-26",level:4},{value:"groupBy",id:"groupby",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-27",level:4},{value:"having",id:"having",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-28",level:4},{value:"index",id:"index",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-29",level:4},{value:"let",id:"let",level:3},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-30",level:4},{value:"letting",id:"letting",level:3},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-31",level:4},{value:"limit",id:"limit",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-32",level:4},{value:"offset",id:"offset",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Overrides",id:"overrides-4",level:4},{value:"Defined in",id:"defined-in-33",level:4},{value:"on",id:"on",level:3},{value:"Parameters",id:"parameters-13",level:4},{value:"Returns",id:"returns-14",level:4},{value:"Defined in",id:"defined-in-34",level:4},{value:"orderBy",id:"orderby",level:3},{value:"Parameters",id:"parameters-14",level:4},{value:"Returns",id:"returns-15",level:4},{value:"Overrides",id:"overrides-5",level:4},{value:"Defined in",id:"defined-in-35",level:4},{value:"plainJoin",id:"plainjoin",level:3},{value:"Parameters",id:"parameters-15",level:4},{value:"Returns",id:"returns-16",level:4},{value:"Defined in",id:"defined-in-36",level:4},{value:"select",id:"select",level:3},{value:"Parameters",id:"parameters-16",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Overrides",id:"overrides-6",level:4},{value:"Defined in",id:"defined-in-37",level:4},{value:"useKeys",id:"usekeys",level:3},{value:"Parameters",id:"parameters-17",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Overrides",id:"overrides-7",level:4},{value:"Defined in",id:"defined-in-38",level:4},{value:"usingGSI",id:"usinggsi",level:3},{value:"Returns",id:"returns-19",level:4},{value:"Defined in",id:"defined-in-39",level:4},{value:"where",id:"where",level:3},{value:"Parameters",id:"parameters-18",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Overrides",id:"overrides-8",level:4},{value:"Defined in",id:"defined-in-40",level:4},{value:"with",id:"with",level:3},{value:"Parameters",id:"parameters-19",level:4},{value:"Returns",id:"returns-21",level:4},{value:"Defined in",id:"defined-in-41",level:4}],o={toc:s};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"BaseQuery")),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Query"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new Query"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"conditions"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"collection"),")"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Summary"))),(0,r.kt)("p",null,"Create an instance of Query."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Name"))),(0,r.kt)("p",null,"Query"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const query = new Query({\n $select: [{ $field: 'address' }],\n $where: {\n $nill: [\n { address: { $like: '%57-59%' } },\n { free_breakfast: true },\n { free_lunch: [1] }\n ]\n }\n },\n 'travel-sample');\n")),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"conditions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"List of SELECT clause conditions")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collection")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Collection name")))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.constructor"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L118"},"query/query.ts:118")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"_collection"},"_","collection"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Protected")," ",(0,r.kt)("strong",{parentName:"p"},"_","collection"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,"BaseQuery.","_","collection"),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/base-query.ts#L14"},"query/base-query.ts:14")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_conditions"},"_","conditions"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Protected")," ",(0,r.kt)("strong",{parentName:"p"},"_","conditions"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr"))),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,"BaseQuery.","_","conditions"),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/base-query.ts#L14"},"query/base-query.ts:14")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"groupbyexpr"},"groupByExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"groupByExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"IGroupBy"),"[]"),(0,r.kt)("p",null,"GROUP BY Expression."),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L50"},"query/query.ts:50")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"havingexpr"},"havingExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"havingExpr"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"HAVING Expression."),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L58"},"query/query.ts:58")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexname"},"indexName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Index name."),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L83"},"query/query.ts:83")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexon"},"indexOn"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexOn"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IIndexOnParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexOnParams")),"[]"),(0,r.kt)("p",null,"INDEX ON Expression."),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L75"},"query/query.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indextype"},"indexType"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexType"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#indextype"},(0,r.kt)("inlineCode",{parentName:"a"},"IndexType"))),(0,r.kt)("p",null,"Types of supported Index statements."),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L79"},"query/query.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexusinggsi"},"indexUsingGSI"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexUsingGSI"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"INDEX USING GSI Expression."),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L87"},"query/query.ts:87")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexwith"},"indexWith"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexWith"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IIndexWithParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexWithParams"))),(0,r.kt)("p",null,"INDEX WITH Expression."),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L91"},"query/query.ts:91")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"letexpr"},"letExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"letExpr"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("p",null,"LET Expression."),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L46"},"query/query.ts:46")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"lettingexpr"},"lettingExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"lettingExpr"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("p",null,"LETTING Expression."),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L54"},"query/query.ts:54")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"limitexpr"},"limitExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"limitExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"LIMIT Expression."),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L38"},"query/query.ts:38")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"offsetexpr"},"offSetExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"offSetExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"OFFSET Expression."),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L42"},"query/query.ts:42")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"orderexpr"},"orderExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"orderExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,r.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,r.kt)("p",null,"ORDER BY Expression."),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L34"},"query/query.ts:34")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"plainjoinexpr"},"plainJoinExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"plainJoinExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Plain JOIN Expression."),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L63"},"query/query.ts:63")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"querytype"},"queryType"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"queryType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"INDEX"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"SELECT"')),(0,r.kt)("p",null,"Available query types."),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L71"},"query/query.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"selectexpr"},"selectExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"selectExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("p",null,"SELECT Expression."),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L26"},"query/query.ts:26")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usekeysexpr"},"useKeysExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"useKeysExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,r.kt)("p",null,"USE Expression."),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L67"},"query/query.ts:67")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"whereexpr"},"whereExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"whereExpr"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"WHERE Expression."),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L30"},"query/query.ts:30")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"collection"},"collection"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"collection"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L735"},"query/query.ts:735")),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," ",(0,r.kt)("strong",{parentName:"p"},"collection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L739"},"query/query.ts:739")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"conditions"},"conditions"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"conditions"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr"))),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L727"},"query/query.ts:727")),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," ",(0,r.kt)("strong",{parentName:"p"},"conditions"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr")))))),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L731"},"query/query.ts:731")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"build"},"build"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"build"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Build a N1QL query from the defined parameters."),(0,r.kt)("p",null,"Can also use ",(0,r.kt)("inlineCode",{parentName:"p"},"ignoreCase")," as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," method, this will always prioritize the ",(0,r.kt)("inlineCode",{parentName:"p"},"$ignoreCase")," value defined in clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const expr_where = {\n $or: [\n { address: { $like: '%57-59%', $ignoreCase: false } }, // ignoreCase will not be applied\n { free_breakfast: true },\n { name: 'John' } // ignoreCase will be applied\n ],\n};\nconst query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .where(expr_where)\n .build({ ignoreCase: true }); // ignore case is enabled for where clause elements\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},'SELECT address\nFROM `travel-sample`\nWHERE (address LIKE "%57-59%" OR free_breakfast = true OR `(LOWER(name) = LOWER("John"))`)\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"QueryBuildOptionsType"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.build"),(0,r.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L668"},"query/query.ts:668")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"compilefromconditions"},"compileFromConditions"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"compileFromConditions"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"conditionals"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Converts the conditional parameters passed to the constructor to the properties of the N1QL Query."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"conditionals")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr")))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-25"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L597"},"query/query.ts:597")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"execute"},"execute"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"execute"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"queryOptions?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"ottomanInstance?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"QueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"QueryBuildOptionsType"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"queryOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"QueryOptions"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ottomanInstance")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"QueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-26"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L719"},"query/query.ts:719")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"groupby"},"groupBy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"groupBy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add GROUP BY expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const groupByExpr = [{ expr: 'COUNT(amount_val)', as: 'amount' }];\nconst query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .groupBy(groupByExpr)\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample`\nGROUP BY COUNT(amount) AS amount\n")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"IGroupBy"),"[]")))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-27"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L508"},"query/query.ts:508")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"having"},"having"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"having"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add HAVING expression to GROUP BY clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const groupByExpr = [{ expr: 'COUNT(amount_val)', as: 'amount' }];\nconst having = { address: { $like: '%58%' } };\nconst query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .groupBy(groupByExpr)\n .having(having)\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample`\nGROUP BY COUNT(amount) AS amount\nHAVING address LIKE '%58%'\n")),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">")))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-28"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L563"},"query/query.ts:563")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"index"},"index"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"index"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"type"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"name"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add index type and name to INDEX clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const result = new Query({}, 'travel-sample')\n .index('DROP', 'travel_sample_id_test')\n .build();\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"DROP INDEX `travel-sample`.`travel_sample_id_test`\n")),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#indextype"},(0,r.kt)("inlineCode",{parentName:"a"},"IndexType")))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-29"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L173"},"query/query.ts:173")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"let"},"let"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"let"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add LET expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// SELECT expression definition\nconst selectExpr = 't1.airportname, t1.geo.lat, t1.geo.lon, t1.city, t1.type';\n\n// LET expression definition\nconst letExpr: LetExprType = {\n min_lat: 71,\n max_lat: 'ABS(t1.geo.lon)*4+1',\n place: '(SELECT RAW t2.country FROM `travel-sample` t2 WHERE t2.type = \"landmark\")',\n};\n\n// WHERE expression definition\nconst whereExpr: LogicalWhereExpr = {\n $and: [\n { 't1.type': 'airport' },\n { 't1.geo.lat': { $gt: { $field: 'min_lat' } } },\n { 't1.geo.lat': { $lt: { $field: 'max_lat' } } },\n { 't1.country': { $in: { $field: 'place' } } },\n ],\n};\n\n// QUERY creation\nconst query = new Query({}, 'travel-sample t1')\n .select(selectExpr)\n .let(letExpr)\n .where(whereExpr)\n .build();\n\nconsole.log(query);\n\n// QUERY output\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},'SELECT t1.airportname,\n t1.geo.lat,\n t1.geo.lon,\n t1.city,\n t1.type\nFROM `travel-sample` t1\nLET min_lat=71,\n max_lat=ABS(t1.geo.lon)*4+1,\n place=(\n SELECT RAW t2.country\n FROM `travel-sample` t2\n WHERE t2.type = "landmark")\nWHERE (t1.type="airport"\n AND t1.geo.lat>min_lat\n AND t1.geo.lat")))),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"overrides-5"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.orderBy"),(0,r.kt)("h4",{id:"defined-in-35"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L342"},"query/query.ts:342")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"plainjoin"},"plainJoin"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"plainJoin"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add JOIN expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-tS"},"const query = new Query({}, 'beer-sample brewery');\nconst result = query.select([{ $field: 'address' }])\n .plainJoin(\n 'JOIN `beer-sample` beer ON beer.brewery_id = LOWER(REPLACE(brewery.name, \" \", \"_\"))'\n )\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},'SELECT beer.name\nFROM `beer-sample` brewery\nJOIN `beer-sample` beer ON beer.brewery_id = LOWER(REPLACE(brewery.name, " ", "_"))\n')),(0,r.kt)("h4",{id:"parameters-15"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-36"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L318"},"query/query.ts:318")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"select"},"select"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"select"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add result selectors to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }]).build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample`\n")),(0,r.kt)("h4",{id:"parameters-16"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]")))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"overrides-6"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.select"),(0,r.kt)("h4",{id:"defined-in-37"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L141"},"query/query.ts:141")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usekeys"},"useKeys"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"useKeys"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add USE KEYS expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .useKeys(['airlineR_8093'])\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample` USE KEYS ['airlineR_8093']\n")),(0,r.kt)("h4",{id:"parameters-17"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"overrides-7"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.useKeys"),(0,r.kt)("h4",{id:"defined-in-38"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L586"},"query/query.ts:586")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usinggsi"},"usingGSI"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"usingGSI"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Create INDEX using General Secondary Index (GSI)."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const result = new Query({}, 'travel-sample')\n .index('CREATE', 'travel_sample_id_test')\n .usingGSI()\n .build();\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"CREATE INDEX `travel_sample_id_test` USING GSI\n")),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-39"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L231"},"query/query.ts:231")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"where"},"where"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"where"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add WHERE expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const expr_where = {\n $or: [\n { address: { $like: '%57-59%' } },\n { free_breakfast: true },\n { name: { $eq: 'John', $ignoreCase: true } }\n ]\n};\nconst query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .where(expr_where)\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},'SELECT address\nFROM `travel-sample`\nWHERE (address LIKE "%57-59%" OR free_breakfast = true OR (LOWER(name) = LOWER("John")))\n')),(0,r.kt)("h4",{id:"parameters-18"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">")))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"overrides-8"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.where"),(0,r.kt)("h4",{id:"defined-in-40"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L292"},"query/query.ts:292")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"with"},"with"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"with"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add items to WITH clause in INDEX clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const withExpr = { nodes: ['192.168.1.1:8078'], defer_build: true, num_replica: 2 };\nconst result = new Query({}, 'travel-sample')\n .index('CREATE', 'travel_sample_id_test')\n .with(withExpr)\n .build();\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"CREATE INDEX `travel_sample_id_test`\nWITH {'nodes': ['192.168.1.1:8078'],'defer_build': true,'num_replica': 2}\n")),(0,r.kt)("h4",{id:"parameters-19"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IIndexWithParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexWithParams")))))),(0,r.kt)("h4",{id:"returns-21"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-41"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/query/query.ts#L258"},"query/query.ts:258")))}u.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[6058],{3905:(e,t,n)=>{n.d(t,{Zo:()=>o,kt:()=>k});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function l(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function i(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var l=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),s=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):i(i({},t),e)),n},o=function(e){var t=s(e.components);return a.createElement(d.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,l=e.originalType,d=e.parentName,o=p(e,["components","mdxType","originalType","parentName"]),m=s(n),k=r,N=m["".concat(d,".").concat(k)]||m[k]||u[k]||l;return n?a.createElement(N,i(i({ref:t},o),{},{components:n})):a.createElement(N,i({ref:t},o))}));function k(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var l=n.length,i=new Array(l);i[0]=m;var p={};for(var d in t)hasOwnProperty.call(t,d)&&(p[d]=t[d]);p.originalType=e,p.mdxType="string"==typeof e?e:r,i[1]=p;for(var s=2;s{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>i,default:()=>u,frontMatter:()=>l,metadata:()=>p,toc:()=>s});var a=n(7462),r=(n(7294),n(3905));const l={id:"Query",title:"Class: Query",sidebar_label:"Query",sidebar_position:0,custom_edit_url:null},i=void 0,p={unversionedId:"api/classes/Query",id:"api/classes/Query",title:"Class: Query",description:"Hierarchy",source:"@site/docs/api/classes/Query.md",sourceDirName:"api/classes",slug:"/api/classes/Query",permalink:"/docs/api/classes/Query",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"Query",title:"Class: Query",sidebar_label:"Query",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"Ottoman",permalink:"/docs/api/classes/Ottoman"},next:{title:"QueryGroupByParamsException",permalink:"/docs/api/classes/QueryGroupByParamsException"}},d={},s=[{value:"Hierarchy",id:"hierarchy",level:2},{value:"Constructors",id:"constructors",level:2},{value:"constructor",id:"constructor",level:3},{value:"Parameters",id:"parameters",level:4},{value:"Overrides",id:"overrides",level:4},{value:"Defined in",id:"defined-in",level:4},{value:"Properties",id:"properties",level:2},{value:"_collection",id:"_collection",level:3},{value:"Inherited from",id:"inherited-from",level:4},{value:"Defined in",id:"defined-in-1",level:4},{value:"_conditions",id:"_conditions",level:3},{value:"Inherited from",id:"inherited-from-1",level:4},{value:"Defined in",id:"defined-in-2",level:4},{value:"groupByExpr",id:"groupbyexpr",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"havingExpr",id:"havingexpr",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"indexName",id:"indexname",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"indexOn",id:"indexon",level:3},{value:"Defined in",id:"defined-in-6",level:4},{value:"indexType",id:"indextype",level:3},{value:"Defined in",id:"defined-in-7",level:4},{value:"indexUsingGSI",id:"indexusinggsi",level:3},{value:"Defined in",id:"defined-in-8",level:4},{value:"indexWith",id:"indexwith",level:3},{value:"Defined in",id:"defined-in-9",level:4},{value:"letExpr",id:"letexpr",level:3},{value:"Defined in",id:"defined-in-10",level:4},{value:"lettingExpr",id:"lettingexpr",level:3},{value:"Defined in",id:"defined-in-11",level:4},{value:"limitExpr",id:"limitexpr",level:3},{value:"Defined in",id:"defined-in-12",level:4},{value:"offSetExpr",id:"offsetexpr",level:3},{value:"Defined in",id:"defined-in-13",level:4},{value:"orderExpr",id:"orderexpr",level:3},{value:"Defined in",id:"defined-in-14",level:4},{value:"plainJoinExpr",id:"plainjoinexpr",level:3},{value:"Defined in",id:"defined-in-15",level:4},{value:"queryType",id:"querytype",level:3},{value:"Defined in",id:"defined-in-16",level:4},{value:"selectExpr",id:"selectexpr",level:3},{value:"Defined in",id:"defined-in-17",level:4},{value:"useKeysExpr",id:"usekeysexpr",level:3},{value:"Defined in",id:"defined-in-18",level:4},{value:"whereExpr",id:"whereexpr",level:3},{value:"Defined in",id:"defined-in-19",level:4},{value:"Accessors",id:"accessors",level:2},{value:"collection",id:"collection",level:3},{value:"Returns",id:"returns",level:4},{value:"Defined in",id:"defined-in-20",level:4},{value:"Parameters",id:"parameters-1",level:4},{value:"Returns",id:"returns-1",level:4},{value:"Defined in",id:"defined-in-21",level:4},{value:"conditions",id:"conditions",level:3},{value:"Returns",id:"returns-2",level:4},{value:"Defined in",id:"defined-in-22",level:4},{value:"Parameters",id:"parameters-2",level:4},{value:"Returns",id:"returns-3",level:4},{value:"Defined in",id:"defined-in-23",level:4},{value:"Methods",id:"methods",level:2},{value:"build",id:"build",level:3},{value:"Parameters",id:"parameters-3",level:4},{value:"Returns",id:"returns-4",level:4},{value:"Overrides",id:"overrides-1",level:4},{value:"Defined in",id:"defined-in-24",level:4},{value:"compileFromConditions",id:"compilefromconditions",level:3},{value:"Parameters",id:"parameters-4",level:4},{value:"Returns",id:"returns-5",level:4},{value:"Defined in",id:"defined-in-25",level:4},{value:"execute",id:"execute",level:3},{value:"Type parameters",id:"type-parameters",level:4},{value:"Parameters",id:"parameters-5",level:4},{value:"Returns",id:"returns-6",level:4},{value:"Defined in",id:"defined-in-26",level:4},{value:"groupBy",id:"groupby",level:3},{value:"Parameters",id:"parameters-6",level:4},{value:"Returns",id:"returns-7",level:4},{value:"Defined in",id:"defined-in-27",level:4},{value:"having",id:"having",level:3},{value:"Parameters",id:"parameters-7",level:4},{value:"Returns",id:"returns-8",level:4},{value:"Defined in",id:"defined-in-28",level:4},{value:"index",id:"index",level:3},{value:"Parameters",id:"parameters-8",level:4},{value:"Returns",id:"returns-9",level:4},{value:"Defined in",id:"defined-in-29",level:4},{value:"let",id:"let",level:3},{value:"Parameters",id:"parameters-9",level:4},{value:"Returns",id:"returns-10",level:4},{value:"Overrides",id:"overrides-2",level:4},{value:"Defined in",id:"defined-in-30",level:4},{value:"letting",id:"letting",level:3},{value:"Parameters",id:"parameters-10",level:4},{value:"Returns",id:"returns-11",level:4},{value:"Defined in",id:"defined-in-31",level:4},{value:"limit",id:"limit",level:3},{value:"Parameters",id:"parameters-11",level:4},{value:"Returns",id:"returns-12",level:4},{value:"Overrides",id:"overrides-3",level:4},{value:"Defined in",id:"defined-in-32",level:4},{value:"offset",id:"offset",level:3},{value:"Parameters",id:"parameters-12",level:4},{value:"Returns",id:"returns-13",level:4},{value:"Overrides",id:"overrides-4",level:4},{value:"Defined in",id:"defined-in-33",level:4},{value:"on",id:"on",level:3},{value:"Parameters",id:"parameters-13",level:4},{value:"Returns",id:"returns-14",level:4},{value:"Defined in",id:"defined-in-34",level:4},{value:"orderBy",id:"orderby",level:3},{value:"Parameters",id:"parameters-14",level:4},{value:"Returns",id:"returns-15",level:4},{value:"Overrides",id:"overrides-5",level:4},{value:"Defined in",id:"defined-in-35",level:4},{value:"plainJoin",id:"plainjoin",level:3},{value:"Parameters",id:"parameters-15",level:4},{value:"Returns",id:"returns-16",level:4},{value:"Defined in",id:"defined-in-36",level:4},{value:"select",id:"select",level:3},{value:"Parameters",id:"parameters-16",level:4},{value:"Returns",id:"returns-17",level:4},{value:"Overrides",id:"overrides-6",level:4},{value:"Defined in",id:"defined-in-37",level:4},{value:"useKeys",id:"usekeys",level:3},{value:"Parameters",id:"parameters-17",level:4},{value:"Returns",id:"returns-18",level:4},{value:"Overrides",id:"overrides-7",level:4},{value:"Defined in",id:"defined-in-38",level:4},{value:"usingGSI",id:"usinggsi",level:3},{value:"Returns",id:"returns-19",level:4},{value:"Defined in",id:"defined-in-39",level:4},{value:"where",id:"where",level:3},{value:"Parameters",id:"parameters-18",level:4},{value:"Returns",id:"returns-20",level:4},{value:"Overrides",id:"overrides-8",level:4},{value:"Defined in",id:"defined-in-40",level:4},{value:"with",id:"with",level:3},{value:"Parameters",id:"parameters-19",level:4},{value:"Returns",id:"returns-21",level:4},{value:"Defined in",id:"defined-in-41",level:4}],o={toc:s};function u(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},o,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"hierarchy"},"Hierarchy"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("inlineCode",{parentName:"p"},"BaseQuery")),(0,r.kt)("p",{parentName:"li"},"\u21b3 ",(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Query"))))),(0,r.kt)("h2",{id:"constructors"},"Constructors"),(0,r.kt)("h3",{id:"constructor"},"constructor"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"new Query"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"conditions"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"collection"),")"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Summary"))),(0,r.kt)("p",null,"Create an instance of Query."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Name"))),(0,r.kt)("p",null,"Query"),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const query = new Query({\n $select: [{ $field: 'address' }],\n $where: {\n $nill: [\n { address: { $like: '%57-59%' } },\n { free_breakfast: true },\n { free_lunch: [1] }\n ]\n }\n },\n 'travel-sample');\n")),(0,r.kt)("h4",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Description"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"conditions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr"))),(0,r.kt)("td",{parentName:"tr",align:"left"},"List of SELECT clause conditions")),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"collection")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")),(0,r.kt)("td",{parentName:"tr",align:"left"},"Collection name")))),(0,r.kt)("h4",{id:"overrides"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.constructor"),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L118"},"query/query.ts:118")),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"_collection"},"_","collection"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Protected")," ",(0,r.kt)("strong",{parentName:"p"},"_","collection"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"inherited-from"},"Inherited from"),(0,r.kt)("p",null,"BaseQuery.","_","collection"),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/base-query.ts#L14"},"query/base-query.ts:14")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"_conditions"},"_","conditions"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Protected")," ",(0,r.kt)("strong",{parentName:"p"},"_","conditions"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr"))),(0,r.kt)("h4",{id:"inherited-from-1"},"Inherited from"),(0,r.kt)("p",null,"BaseQuery.","_","conditions"),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/base-query.ts#L14"},"query/base-query.ts:14")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"groupbyexpr"},"groupByExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"groupByExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"IGroupBy"),"[]"),(0,r.kt)("p",null,"GROUP BY Expression."),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L50"},"query/query.ts:50")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"havingexpr"},"havingExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"havingExpr"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"HAVING Expression."),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L58"},"query/query.ts:58")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexname"},"indexName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Index name."),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L83"},"query/query.ts:83")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexon"},"indexOn"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexOn"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IIndexOnParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexOnParams")),"[]"),(0,r.kt)("p",null,"INDEX ON Expression."),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L75"},"query/query.ts:75")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indextype"},"indexType"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexType"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#indextype"},(0,r.kt)("inlineCode",{parentName:"a"},"IndexType"))),(0,r.kt)("p",null,"Types of supported Index statements."),(0,r.kt)("h4",{id:"defined-in-7"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L79"},"query/query.ts:79")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexusinggsi"},"indexUsingGSI"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexUsingGSI"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"boolean")),(0,r.kt)("p",null,"INDEX USING GSI Expression."),(0,r.kt)("h4",{id:"defined-in-8"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L87"},"query/query.ts:87")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"indexwith"},"indexWith"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"indexWith"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IIndexWithParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexWithParams"))),(0,r.kt)("p",null,"INDEX WITH Expression."),(0,r.kt)("h4",{id:"defined-in-9"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L91"},"query/query.ts:91")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"letexpr"},"letExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"letExpr"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("p",null,"LET Expression."),(0,r.kt)("h4",{id:"defined-in-10"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L46"},"query/query.ts:46")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"lettingexpr"},"lettingExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"lettingExpr"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#letexprtype"},(0,r.kt)("inlineCode",{parentName:"a"},"LetExprType"))),(0,r.kt)("p",null,"LETTING Expression."),(0,r.kt)("h4",{id:"defined-in-11"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L54"},"query/query.ts:54")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"limitexpr"},"limitExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"limitExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"LIMIT Expression."),(0,r.kt)("h4",{id:"defined-in-12"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L38"},"query/query.ts:38")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"offsetexpr"},"offSetExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"offSetExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("p",null,"OFFSET Expression."),(0,r.kt)("h4",{id:"defined-in-13"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L42"},"query/query.ts:42")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"orderexpr"},"orderExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"orderExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"Record"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"string"),", ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#sorttype"},(0,r.kt)("inlineCode",{parentName:"a"},"SortType")),">"),(0,r.kt)("p",null,"ORDER BY Expression."),(0,r.kt)("h4",{id:"defined-in-14"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L34"},"query/query.ts:34")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"plainjoinexpr"},"plainJoinExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"plainJoinExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Plain JOIN Expression."),(0,r.kt)("h4",{id:"defined-in-15"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L63"},"query/query.ts:63")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"querytype"},"queryType"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"queryType"),": ",(0,r.kt)("inlineCode",{parentName:"p"},'"INDEX"')," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},'"SELECT"')),(0,r.kt)("p",null,"Available query types."),(0,r.kt)("h4",{id:"defined-in-16"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L71"},"query/query.ts:71")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"selectexpr"},"selectExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"selectExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")," ","|"," ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]"),(0,r.kt)("p",null,"SELECT Expression."),(0,r.kt)("h4",{id:"defined-in-17"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L26"},"query/query.ts:26")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usekeysexpr"},"useKeysExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"useKeysExpr"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string"),"[]"),(0,r.kt)("p",null,"USE Expression."),(0,r.kt)("h4",{id:"defined-in-18"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L67"},"query/query.ts:67")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"whereexpr"},"whereExpr"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Private")," ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"whereExpr"),": ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"p"},"any"),">"),(0,r.kt)("p",null,"WHERE Expression."),(0,r.kt)("h4",{id:"defined-in-19"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L30"},"query/query.ts:30")),(0,r.kt)("h2",{id:"accessors"},"Accessors"),(0,r.kt)("h3",{id:"collection"},"collection"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"collection"),"(): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-20"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L735"},"query/query.ts:735")),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," ",(0,r.kt)("strong",{parentName:"p"},"collection"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-1"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-1"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-21"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L739"},"query/query.ts:739")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"conditions"},"conditions"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"get")," ",(0,r.kt)("strong",{parentName:"p"},"conditions"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr"))),(0,r.kt)("h4",{id:"returns-2"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr"))),(0,r.kt)("h4",{id:"defined-in-22"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L727"},"query/query.ts:727")),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"set")," ",(0,r.kt)("strong",{parentName:"p"},"conditions"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"parameters-2"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr")))))),(0,r.kt)("h4",{id:"returns-3"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-23"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L731"},"query/query.ts:731")),(0,r.kt)("h2",{id:"methods"},"Methods"),(0,r.kt)("h3",{id:"build"},"build"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"build"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("p",null,"Build a N1QL query from the defined parameters."),(0,r.kt)("p",null,"Can also use ",(0,r.kt)("inlineCode",{parentName:"p"},"ignoreCase")," as part of the ",(0,r.kt)("inlineCode",{parentName:"p"},"build")," method, this will always prioritize the ",(0,r.kt)("inlineCode",{parentName:"p"},"$ignoreCase")," value defined in clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const expr_where = {\n $or: [\n { address: { $like: '%57-59%', $ignoreCase: false } }, // ignoreCase will not be applied\n { free_breakfast: true },\n { name: 'John' } // ignoreCase will be applied\n ],\n};\nconst query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .where(expr_where)\n .build({ ignoreCase: true }); // ignore case is enabled for where clause elements\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},'SELECT address\nFROM `travel-sample`\nWHERE (address LIKE "%57-59%" OR free_breakfast = true OR `(LOWER(name) = LOWER("John"))`)\n')),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("h4",{id:"parameters-3"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"QueryBuildOptionsType"))))),(0,r.kt)("h4",{id:"returns-4"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"overrides-1"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.build"),(0,r.kt)("h4",{id:"defined-in-24"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L668"},"query/query.ts:668")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"compilefromconditions"},"compileFromConditions"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"compileFromConditions"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"conditionals"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("p",null,"Converts the conditional parameters passed to the constructor to the properties of the N1QL Query."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("h4",{id:"parameters-4"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"conditionals")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IConditionExpr"},(0,r.kt)("inlineCode",{parentName:"a"},"IConditionExpr")))))),(0,r.kt)("h4",{id:"returns-5"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"void")),(0,r.kt)("h4",{id:"defined-in-25"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L597"},"query/query.ts:597")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"execute"},"execute"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"execute"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">","(",(0,r.kt)("inlineCode",{parentName:"p"},"options?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"queryOptions?"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"ottomanInstance?"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"QueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"type-parameters"},"Type parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Result")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"any"))))),(0,r.kt)("h4",{id:"parameters-5"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"options")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"QueryBuildOptionsType"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"queryOptions")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"QueryOptions"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ottomanInstance")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/classes/Ottoman"},(0,r.kt)("inlineCode",{parentName:"a"},"Ottoman")))))),(0,r.kt)("h4",{id:"returns-6"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"QueryResult"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">",">"," ","|"," ",(0,r.kt)("inlineCode",{parentName:"p"},"Promise"),"<",(0,r.kt)("inlineCode",{parentName:"p"},"Result"),">"),(0,r.kt)("h4",{id:"defined-in-26"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L719"},"query/query.ts:719")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"groupby"},"groupBy"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"groupBy"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add GROUP BY expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const groupByExpr = [{ expr: 'COUNT(amount_val)', as: 'amount' }];\nconst query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .groupBy(groupByExpr)\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample`\nGROUP BY COUNT(amount) AS amount\n")),(0,r.kt)("h4",{id:"parameters-6"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"IGroupBy"),"[]")))),(0,r.kt)("h4",{id:"returns-7"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-27"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L508"},"query/query.ts:508")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"having"},"having"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"having"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add HAVING expression to GROUP BY clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const groupByExpr = [{ expr: 'COUNT(amount_val)', as: 'amount' }];\nconst having = { address: { $like: '%58%' } };\nconst query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .groupBy(groupByExpr)\n .having(having)\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample`\nGROUP BY COUNT(amount) AS amount\nHAVING address LIKE '%58%'\n")),(0,r.kt)("h4",{id:"parameters-7"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">")))),(0,r.kt)("h4",{id:"returns-8"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-28"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L563"},"query/query.ts:563")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"index"},"index"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"index"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"type"),", ",(0,r.kt)("inlineCode",{parentName:"p"},"name"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add index type and name to INDEX clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const result = new Query({}, 'travel-sample')\n .index('DROP', 'travel_sample_id_test')\n .build();\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"DROP INDEX `travel-sample`.`travel_sample_id_test`\n")),(0,r.kt)("h4",{id:"parameters-8"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"type")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#indextype"},(0,r.kt)("inlineCode",{parentName:"a"},"IndexType")))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"name")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-9"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-29"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L173"},"query/query.ts:173")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"let"},"let"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"let"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add LET expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"// SELECT expression definition\nconst selectExpr = 't1.airportname, t1.geo.lat, t1.geo.lon, t1.city, t1.type';\n\n// LET expression definition\nconst letExpr: LetExprType = {\n min_lat: 71,\n max_lat: 'ABS(t1.geo.lon)*4+1',\n place: '(SELECT RAW t2.country FROM `travel-sample` t2 WHERE t2.type = \"landmark\")',\n};\n\n// WHERE expression definition\nconst whereExpr: LogicalWhereExpr = {\n $and: [\n { 't1.type': 'airport' },\n { 't1.geo.lat': { $gt: { $field: 'min_lat' } } },\n { 't1.geo.lat': { $lt: { $field: 'max_lat' } } },\n { 't1.country': { $in: { $field: 'place' } } },\n ],\n};\n\n// QUERY creation\nconst query = new Query({}, 'travel-sample t1')\n .select(selectExpr)\n .let(letExpr)\n .where(whereExpr)\n .build();\n\nconsole.log(query);\n\n// QUERY output\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},'SELECT t1.airportname,\n t1.geo.lat,\n t1.geo.lon,\n t1.city,\n t1.type\nFROM `travel-sample` t1\nLET min_lat=71,\n max_lat=ABS(t1.geo.lon)*4+1,\n place=(\n SELECT RAW t2.country\n FROM `travel-sample` t2\n WHERE t2.type = "landmark")\nWHERE (t1.type="airport"\n AND t1.geo.lat>min_lat\n AND t1.geo.lat")))),(0,r.kt)("h4",{id:"returns-15"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"overrides-5"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.orderBy"),(0,r.kt)("h4",{id:"defined-in-35"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L342"},"query/query.ts:342")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"plainjoin"},"plainJoin"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"plainJoin"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add JOIN expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-tS"},"const query = new Query({}, 'beer-sample brewery');\nconst result = query.select([{ $field: 'address' }])\n .plainJoin(\n 'JOIN `beer-sample` beer ON beer.brewery_id = LOWER(REPLACE(brewery.name, \" \", \"_\"))'\n )\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},'SELECT beer.name\nFROM `beer-sample` brewery\nJOIN `beer-sample` beer ON beer.brewery_id = LOWER(REPLACE(brewery.name, " ", "_"))\n')),(0,r.kt)("h4",{id:"parameters-15"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"))))),(0,r.kt)("h4",{id:"returns-16"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-36"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L318"},"query/query.ts:318")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"select"},"select"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"select"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value?"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add result selectors to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }]).build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample`\n")),(0,r.kt)("h4",{id:"parameters-16"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value?")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string")," ","|"," ",(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#iselecttype"},(0,r.kt)("inlineCode",{parentName:"a"},"ISelectType")),"[]")))),(0,r.kt)("h4",{id:"returns-17"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"overrides-6"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.select"),(0,r.kt)("h4",{id:"defined-in-37"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L141"},"query/query.ts:141")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usekeys"},"useKeys"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"useKeys"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add USE KEYS expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .useKeys(['airlineR_8093'])\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"SELECT address\nFROM `travel-sample` USE KEYS ['airlineR_8093']\n")),(0,r.kt)("h4",{id:"parameters-17"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"string"),"[]")))),(0,r.kt)("h4",{id:"returns-18"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"overrides-7"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.useKeys"),(0,r.kt)("h4",{id:"defined-in-38"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L586"},"query/query.ts:586")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"usinggsi"},"usingGSI"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"usingGSI"),"(): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Create INDEX using General Secondary Index (GSI)."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const result = new Query({}, 'travel-sample')\n .index('CREATE', 'travel_sample_id_test')\n .usingGSI()\n .build();\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"CREATE INDEX `travel_sample_id_test` USING GSI\n")),(0,r.kt)("h4",{id:"returns-19"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-39"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L231"},"query/query.ts:231")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"where"},"where"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"where"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add WHERE expression to SELECT clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const expr_where = {\n $or: [\n { address: { $like: '%57-59%' } },\n { free_breakfast: true },\n { name: { $eq: 'John', $ignoreCase: true } }\n ]\n};\nconst query = new Query({}, 'travel-sample');\nconst result = query.select([{ $field: 'address' }])\n .where(expr_where)\n .build()\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},'SELECT address\nFROM `travel-sample`\nWHERE (address LIKE "%57-59%" OR free_breakfast = true OR (LOWER(name) = LOWER("John")))\n')),(0,r.kt)("h4",{id:"parameters-18"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/modules#logicalwhereexpr"},(0,r.kt)("inlineCode",{parentName:"a"},"LogicalWhereExpr")),"<",(0,r.kt)("inlineCode",{parentName:"td"},"any"),">")))),(0,r.kt)("h4",{id:"returns-20"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"overrides-8"},"Overrides"),(0,r.kt)("p",null,"BaseQuery.where"),(0,r.kt)("h4",{id:"defined-in-40"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L292"},"query/query.ts:292")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"with"},"with"),(0,r.kt)("p",null,"\u25b8 ",(0,r.kt)("strong",{parentName:"p"},"with"),"(",(0,r.kt)("inlineCode",{parentName:"p"},"value"),"): ",(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("p",null,"Add items to WITH clause in INDEX clause."),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Method"))),(0,r.kt)("p",null,(0,r.kt)("strong",{parentName:"p"},(0,r.kt)("inlineCode",{parentName:"strong"},"Example"))),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-ts"},"const withExpr = { nodes: ['192.168.1.1:8078'], defer_build: true, num_replica: 2 };\nconst result = new Query({}, 'travel-sample')\n .index('CREATE', 'travel_sample_id_test')\n .with(withExpr)\n .build();\nconsole.log(result)\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-sql"},"CREATE INDEX `travel_sample_id_test`\nWITH {'nodes': ['192.168.1.1:8078'],'defer_build': true,'num_replica': 2}\n")),(0,r.kt)("h4",{id:"parameters-19"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"value")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("a",{parentName:"td",href:"/docs/api/interfaces/IIndexWithParams"},(0,r.kt)("inlineCode",{parentName:"a"},"IIndexWithParams")))))),(0,r.kt)("h4",{id:"returns-21"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"/docs/api/classes/Query"},(0,r.kt)("inlineCode",{parentName:"a"},"Query"))),(0,r.kt)("h4",{id:"defined-in-41"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/query/query.ts#L258"},"query/query.ts:258")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f6f984bd.c592cd96.js b/assets/js/f6f984bd.ceea2554.js similarity index 97% rename from assets/js/f6f984bd.c592cd96.js rename to assets/js/f6f984bd.ceea2554.js index fa01460b..ae939834 100644 --- a/assets/js/f6f984bd.c592cd96.js +++ b/assets/js/f6f984bd.ceea2554.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[2604],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(r),f=a,m=u["".concat(s,".").concat(f)]||u[f]||d[f]||i;return r?n.createElement(m,o(o({ref:t},c),{},{components:r})):n.createElement(m,o({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=u;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:a,o[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var n=r(7462),a=(r(7294),r(3905));const i={id:"ValidatorOption",title:"Interface: ValidatorOption",sidebar_label:"ValidatorOption",sidebar_position:0,custom_edit_url:null},o=void 0,p={unversionedId:"api/interfaces/ValidatorOption",id:"api/interfaces/ValidatorOption",title:"Interface: ValidatorOption",description:"Properties",source:"@site/docs/api/interfaces/ValidatorOption.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/ValidatorOption",permalink:"/docs/api/interfaces/ValidatorOption",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ValidatorOption",title:"Interface: ValidatorOption",sidebar_label:"ValidatorOption",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"UpdateManyOptions",permalink:"/docs/api/interfaces/UpdateManyOptions"},next:{title:"saveOptions",permalink:"/docs/api/interfaces/saveOptions"}},s={},l=[{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"regexp",id:"regexp",level:3},{value:"Defined in",id:"defined-in-1",level:4}],c={toc:l};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"message"},"message"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"message"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L26"},"schema/interfaces/schema.types.ts:26")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"regexp"},"regexp"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"regexp"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"RegExp")),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/schema/interfaces/schema.types.ts#L25"},"schema/interfaces/schema.types.ts:25")))}d.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[2604],{3905:(e,t,r)=>{r.d(t,{Zo:()=>c,kt:()=>f});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),l=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},c=function(e){var t=l(e.components);return n.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},u=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,c=p(e,["components","mdxType","originalType","parentName"]),u=l(r),f=a,m=u["".concat(s,".").concat(f)]||u[f]||d[f]||i;return r?n.createElement(m,o(o({ref:t},c),{},{components:r})):n.createElement(m,o({ref:t},c))}));function f(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=u;var p={};for(var s in t)hasOwnProperty.call(t,s)&&(p[s]=t[s]);p.originalType=e,p.mdxType="string"==typeof e?e:a,o[1]=p;for(var l=2;l{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>d,frontMatter:()=>i,metadata:()=>p,toc:()=>l});var n=r(7462),a=(r(7294),r(3905));const i={id:"ValidatorOption",title:"Interface: ValidatorOption",sidebar_label:"ValidatorOption",sidebar_position:0,custom_edit_url:null},o=void 0,p={unversionedId:"api/interfaces/ValidatorOption",id:"api/interfaces/ValidatorOption",title:"Interface: ValidatorOption",description:"Properties",source:"@site/docs/api/interfaces/ValidatorOption.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/ValidatorOption",permalink:"/docs/api/interfaces/ValidatorOption",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"ValidatorOption",title:"Interface: ValidatorOption",sidebar_label:"ValidatorOption",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"UpdateManyOptions",permalink:"/docs/api/interfaces/UpdateManyOptions"},next:{title:"saveOptions",permalink:"/docs/api/interfaces/saveOptions"}},s={},l=[{value:"Properties",id:"properties",level:2},{value:"message",id:"message",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"regexp",id:"regexp",level:3},{value:"Defined in",id:"defined-in-1",level:4}],c={toc:l};function d(e){let{components:t,...r}=e;return(0,a.kt)("wrapper",(0,n.Z)({},c,r,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h2",{id:"properties"},"Properties"),(0,a.kt)("h3",{id:"message"},"message"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"message"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"string")),(0,a.kt)("h4",{id:"defined-in"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L26"},"schema/interfaces/schema.types.ts:26")),(0,a.kt)("hr",null),(0,a.kt)("h3",{id:"regexp"},"regexp"),(0,a.kt)("p",null,"\u2022 ",(0,a.kt)("strong",{parentName:"p"},"regexp"),": ",(0,a.kt)("inlineCode",{parentName:"p"},"RegExp")),(0,a.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,a.kt)("p",null,(0,a.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/schema/interfaces/schema.types.ts#L25"},"schema/interfaces/schema.types.ts:25")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/f837a72c.3cf5a69b.js b/assets/js/f837a72c.fcf73b86.js similarity index 90% rename from assets/js/f837a72c.3cf5a69b.js rename to assets/js/f837a72c.fcf73b86.js index db1e17df..72df53f3 100644 --- a/assets/js/f837a72c.3cf5a69b.js +++ b/assets/js/f837a72c.fcf73b86.js @@ -1 +1 @@ -"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[2835],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>u});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),m=p(n),u=r,f=m["".concat(d,".").concat(u)]||m[u]||s[u]||i;return n?a.createElement(f,l(l({ref:t},c),{},{components:n})):a.createElement(f,l({ref:t},c))}));function u(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=m;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>s,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const i={id:"CreateModelOptions",title:"Interface: CreateModelOptions",sidebar_label:"CreateModelOptions",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/CreateModelOptions",id:"api/interfaces/CreateModelOptions",title:"Interface: CreateModelOptions",description:"Properties",source:"@site/docs/api/interfaces/CreateModelOptions.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/CreateModelOptions",permalink:"/docs/api/interfaces/CreateModelOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"CreateModelOptions",title:"Interface: CreateModelOptions",sidebar_label:"CreateModelOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"WhereClauseException",permalink:"/docs/api/classes/WhereClauseException"},next:{title:"FindOneAndUpdateOption",permalink:"/docs/api/interfaces/FindOneAndUpdateOption"}},d={},p=[{value:"Properties",id:"properties",level:2},{value:"collectionName",id:"collectionname",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"idKey",id:"idkey",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"keyGenerator",id:"keygenerator",level:3},{value:"Type declaration",id:"type-declaration",level:4},{value:"Parameters",id:"parameters",level:5},{value:"Returns",id:"returns",level:5},{value:"Defined in",id:"defined-in-2",level:4},{value:"keyGeneratorDelimiter",id:"keygeneratordelimiter",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"modelKey",id:"modelkey",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"scopeName",id:"scopename",level:3},{value:"Defined in",id:"defined-in-6",level:4}],c={toc:p};function s(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"collectionname"},"collectionName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"collectionName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L16"},"model/interfaces/create-model.interface.ts:16")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"idkey"},"idKey"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"idKey"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L18"},"model/interfaces/create-model.interface.ts:18")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"keygenerator"},"keyGenerator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"keyGenerator"),": (",(0,r.kt)("inlineCode",{parentName:"p"},"params"),": { ",(0,r.kt)("inlineCode",{parentName:"p"},"metadata"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ModelMetadata")," }) => ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"type-declaration"},"Type declaration"),(0,r.kt)("p",null,"\u25b8 (",(0,r.kt)("inlineCode",{parentName:"p"},"params"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h5",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params.metadata")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ModelMetadata"))))),(0,r.kt)("h5",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L21"},"model/interfaces/create-model.interface.ts:21")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"keygeneratordelimiter"},"keyGeneratorDelimiter"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"keyGeneratorDelimiter"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L22"},"model/interfaces/create-model.interface.ts:22")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L20"},"model/interfaces/create-model.interface.ts:20")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"modelkey"},"modelKey"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"modelKey"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L19"},"model/interfaces/create-model.interface.ts:19")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scopename"},"scopeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"scopeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/369c827/src/model/interfaces/create-model.interface.ts#L17"},"model/interfaces/create-model.interface.ts:17")))}s.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[2835],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>f});var a=n(7294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function l(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(a=0;a=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var d=a.createContext({}),p=function(e){var t=a.useContext(d),n=t;return e&&(n="function"==typeof e?e(t):l(l({},t),e)),n},c=function(e){var t=p(e.components);return a.createElement(d.Provider,{value:t},e.children)},s={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,d=e.parentName,c=o(e,["components","mdxType","originalType","parentName"]),m=p(n),f=r,u=m["".concat(d,".").concat(f)]||m[f]||s[f]||i;return n?a.createElement(u,l(l({ref:t},c),{},{components:n})):a.createElement(u,l({ref:t},c))}));function f(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,l=new Array(i);l[0]=m;var o={};for(var d in t)hasOwnProperty.call(t,d)&&(o[d]=t[d]);o.originalType=e,o.mdxType="string"==typeof e?e:r,l[1]=o;for(var p=2;p{n.r(t),n.d(t,{assets:()=>d,contentTitle:()=>l,default:()=>s,frontMatter:()=>i,metadata:()=>o,toc:()=>p});var a=n(7462),r=(n(7294),n(3905));const i={id:"CreateModelOptions",title:"Interface: CreateModelOptions",sidebar_label:"CreateModelOptions",sidebar_position:0,custom_edit_url:null},l=void 0,o={unversionedId:"api/interfaces/CreateModelOptions",id:"api/interfaces/CreateModelOptions",title:"Interface: CreateModelOptions",description:"Properties",source:"@site/docs/api/interfaces/CreateModelOptions.md",sourceDirName:"api/interfaces",slug:"/api/interfaces/CreateModelOptions",permalink:"/docs/api/interfaces/CreateModelOptions",draft:!1,editUrl:null,tags:[],version:"current",sidebarPosition:0,frontMatter:{id:"CreateModelOptions",title:"Interface: CreateModelOptions",sidebar_label:"CreateModelOptions",sidebar_position:0,custom_edit_url:null},sidebar:"tutorialSidebar",previous:{title:"WhereClauseException",permalink:"/docs/api/classes/WhereClauseException"},next:{title:"FindOneAndUpdateOption",permalink:"/docs/api/interfaces/FindOneAndUpdateOption"}},d={},p=[{value:"Properties",id:"properties",level:2},{value:"collectionName",id:"collectionname",level:3},{value:"Defined in",id:"defined-in",level:4},{value:"idKey",id:"idkey",level:3},{value:"Defined in",id:"defined-in-1",level:4},{value:"keyGenerator",id:"keygenerator",level:3},{value:"Type declaration",id:"type-declaration",level:4},{value:"Parameters",id:"parameters",level:5},{value:"Returns",id:"returns",level:5},{value:"Defined in",id:"defined-in-2",level:4},{value:"keyGeneratorDelimiter",id:"keygeneratordelimiter",level:3},{value:"Defined in",id:"defined-in-3",level:4},{value:"maxExpiry",id:"maxexpiry",level:3},{value:"Defined in",id:"defined-in-4",level:4},{value:"modelKey",id:"modelkey",level:3},{value:"Defined in",id:"defined-in-5",level:4},{value:"scopeName",id:"scopename",level:3},{value:"Defined in",id:"defined-in-6",level:4}],c={toc:p};function s(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,a.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h2",{id:"properties"},"Properties"),(0,r.kt)("h3",{id:"collectionname"},"collectionName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"collectionName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L16"},"model/interfaces/create-model.interface.ts:16")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"idkey"},"idKey"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"idKey"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-1"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L18"},"model/interfaces/create-model.interface.ts:18")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"keygenerator"},"keyGenerator"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"keyGenerator"),": (",(0,r.kt)("inlineCode",{parentName:"p"},"params"),": { ",(0,r.kt)("inlineCode",{parentName:"p"},"metadata"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"ModelMetadata")," }) => ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"type-declaration"},"Type declaration"),(0,r.kt)("p",null,"\u25b8 (",(0,r.kt)("inlineCode",{parentName:"p"},"params"),"): ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h5",{id:"parameters"},"Parameters"),(0,r.kt)("table",null,(0,r.kt)("thead",{parentName:"table"},(0,r.kt)("tr",{parentName:"thead"},(0,r.kt)("th",{parentName:"tr",align:"left"},"Name"),(0,r.kt)("th",{parentName:"tr",align:"left"},"Type"))),(0,r.kt)("tbody",{parentName:"table"},(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"Object"))),(0,r.kt)("tr",{parentName:"tbody"},(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"params.metadata")),(0,r.kt)("td",{parentName:"tr",align:"left"},(0,r.kt)("inlineCode",{parentName:"td"},"ModelMetadata"))))),(0,r.kt)("h5",{id:"returns"},"Returns"),(0,r.kt)("p",null,(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-2"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L21"},"model/interfaces/create-model.interface.ts:21")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"keygeneratordelimiter"},"keyGeneratorDelimiter"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"keyGeneratorDelimiter"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-3"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L22"},"model/interfaces/create-model.interface.ts:22")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"maxexpiry"},"maxExpiry"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("inlineCode",{parentName:"p"},"Optional")," ",(0,r.kt)("strong",{parentName:"p"},"maxExpiry"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"number")),(0,r.kt)("h4",{id:"defined-in-4"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L20"},"model/interfaces/create-model.interface.ts:20")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"modelkey"},"modelKey"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"modelKey"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-5"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L19"},"model/interfaces/create-model.interface.ts:19")),(0,r.kt)("hr",null),(0,r.kt)("h3",{id:"scopename"},"scopeName"),(0,r.kt)("p",null,"\u2022 ",(0,r.kt)("strong",{parentName:"p"},"scopeName"),": ",(0,r.kt)("inlineCode",{parentName:"p"},"string")),(0,r.kt)("h4",{id:"defined-in-6"},"Defined in"),(0,r.kt)("p",null,(0,r.kt)("a",{parentName:"p",href:"https://github.com/couchbaselabs/node-ottoman/blob/fce4162/src/model/interfaces/create-model.interface.ts#L17"},"model/interfaces/create-model.interface.ts:17")))}s.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/main.0cca8e5b.js b/assets/js/main.0cca8e5b.js new file mode 100644 index 00000000..09e90178 --- /dev/null +++ b/assets/js/main.0cca8e5b.js @@ -0,0 +1,2 @@ +/*! For license information please see main.0cca8e5b.js.LICENSE.txt */ +(self.webpackChunkottoman_documentation=self.webpackChunkottoman_documentation||[]).push([[179],{830:(e,t,n)=>{"use strict";n.d(t,{W:()=>a});var r=n(7294);function a(){return r.createElement("svg",{width:"20",height:"20",className:"DocSearch-Search-Icon",viewBox:"0 0 20 20"},r.createElement("path",{d:"M14.386 14.386l4.0877 4.0877-4.0877-4.0877c-2.9418 2.9419-7.7115 2.9419-10.6533 0-2.9419-2.9418-2.9419-7.7115 0-10.6533 2.9418-2.9419 7.7115-2.9419 10.6533 0 2.9419 2.9418 2.9419 7.7115 0 10.6533z",stroke:"currentColor",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round"}))}},723:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(7294),a=n(7462),o=n(8356),i=n.n(o),l=n(6887);const s={"0176426c":[()=>n.e(2881).then(n.bind(n,5360)),"@site/docs/api/classes/EmbedType.md",5360],"0480b142":[()=>n.e(836).then(n.bind(n,3584)),"@site/docs/faq.md",3584],"0e384e19":[()=>n.e(9671).then(n.bind(n,9881)),"@site/docs/intro.md",9881],"12f9af5b":[()=>n.e(9955).then(n.bind(n,4036)),"@site/docs/api/classes/MultipleQueryTypesException.md",4036],"177b2302":[()=>n.e(5707).then(n.bind(n,4250)),"@site/docs/api/enums/SearchConsistency.md",4250],17896441:[()=>Promise.all([n.e(532),n.e(1690),n.e(7918)]).then(n.bind(n,903)),"@theme/DocItem",903],"1a4e3797":[()=>Promise.all([n.e(532),n.e(7920)]).then(n.bind(n,6675)),"@theme/SearchPage",6675],"1a5f8759":[()=>n.e(9789).then(n.bind(n,159)),"@site/docs/advanced/how-ottoman-works.md",159],"1be78505":[()=>Promise.all([n.e(532),n.e(9514)]).then(n.bind(n,9963)),"@theme/DocPage",9963],"1dc01822":[()=>n.e(56).then(n.bind(n,7149)),"@site/docs/api/interfaces/IField.md",7149],"1f30904d":[()=>n.e(1117).then(n.bind(n,7753)),"@site/docs/api/interfaces/IIndexOnParams.md",7753],"1f391b9e":[()=>Promise.all([n.e(532),n.e(1690),n.e(3085)]).then(n.bind(n,4247)),"@theme/MDXPage",4247],"2750fe84":[()=>n.e(7453).then(n.bind(n,2347)),"@site/docs/api/classes/FindOptions.md",2347],"2cc19b28":[()=>n.e(2428).then(n.bind(n,2996)),"@site/docs/advanced/transactions.md",2996],"308cf47a":[()=>n.e(4447).then(n.bind(n,1118)),"@site/docs/api/enums/VALIDATION_STRATEGY.md",1118],"336d0c37":[()=>n.e(4397).then(n.bind(n,7842)),"@site/docs/api/classes/Model.md",7842],"393be207":[()=>n.e(7414).then(n.bind(n,3123)),"@site/src/pages/markdown-page.md",3123],"3f30fbc6":[()=>n.e(6891).then(n.bind(n,501)),"@site/docs/api/interfaces/UpdateManyOptions.md",501],"424d0b50":[()=>n.e(9839).then(n.bind(n,2184)),"@site/docs/api/classes/DateType.md",2184],"5189ce25":[()=>n.e(4097).then(n.bind(n,2580)),"@site/docs/api/classes/BuildSchemaError.md",2580],"51c13b82":[()=>n.e(5944).then(n.bind(n,9708)),"@site/docs/api/classes/Schema.md",9708],"54834a7a":[()=>n.e(6290).then(n.bind(n,7232)),"@site/docs/api/interfaces/saveOptions.md",7232],"54f6948a":[()=>n.e(6168).then(n.bind(n,8962)),"@site/docs/api/classes/ReferenceType.md",8962],"57aadcb5":[()=>n.e(3675).then(n.bind(n,648)),"@site/docs/api/classes/ViewIndexOptions.md",648],"5e86e696":[()=>n.e(92).then(n.bind(n,4429)),"@site/docs/api/classes/WhereClauseException.md",4429],"5e8c322a":[()=>n.e(7597).then(n.bind(n,7926)),"@site/docs/api/index.md",7926],"5e9f5e1a":[()=>Promise.resolve().then(n.bind(n,6809)),"@generated/docusaurus.config",6809],"62463dcd":[()=>n.e(8938).then(n.bind(n,46)),"@site/docs/api/classes/QueryGroupByParamsException.md",46],"63a09e0f":[()=>n.e(978).then(n.bind(n,2944)),"@site/docs/api/classes/QueryOperatorNotFoundException.md",2944],"6459de48":[()=>n.e(3462).then(n.bind(n,1781)),"@site/docs/api/classes/CoreType.md",1781],"69d5a9da":[()=>n.e(4916).then(n.bind(n,8315)),"@site/docs/advanced/sdk-comparison.md",8315],"6aa5616b":[()=>n.e(1423).then(n.bind(n,7597)),"@site/docs/api/interfaces/IConditionExpr.md",7597],"712daa7a":[()=>n.e(6877).then(n.bind(n,5490)),"@site/docs/advanced/ottomanV1-to-ottomanV2.md",5490],72264558:[()=>n.e(5466).then(n.bind(n,4637)),"@site/docs/api/classes/MixedType.md",4637],"72e14192":[()=>n.e(7239).then(n.bind(n,4181)),"@site/docs/quick-start.md",4181],"7818dcef":[()=>n.e(1032).then(n.bind(n,8183)),"@site/docs/basic/query-builder.md",8183],"7bc59f94":[()=>n.e(9664).then(n.bind(n,9690)),"@site/docs/api/classes/FindByIdOptions.md",9690],"8323ef92":[()=>n.e(8380).then(n.bind(n,133)),"@site/docs/basic/schema.md",133],"84d23edd":[()=>n.e(6458).then(n.bind(n,2176)),"@site/docs/api/interfaces/ModelOptions.md",2176],"8658577b":[()=>n.e(5435).then(n.bind(n,3893)),"@site/docs/api/interfaces/IManyQueryResponse.md",3893],"918b2342":[()=>n.e(3313).then(n.bind(n,1632)),"@site/docs/api/classes/Document.md",1632],"935f2afb":[()=>n.e(53).then(n.t.bind(n,1109,19)),"~docs/default/version-current-metadata-prop-751.json",1109],"944c12e3":[()=>n.e(7347).then(n.bind(n,9866)),"@site/docs/api/classes/IndexParamsOnExceptions.md",9866],"95142d39":[()=>n.e(3128).then(n.bind(n,6851)),"@site/docs/api/interfaces/FindOneAndUpdateOption.md",6851],"98d6301d":[()=>n.e(8391).then(n.bind(n,6966)),"@site/docs/advanced/ottoman-couchbase.md",6966],"9c1d2067":[()=>n.e(3330).then(n.bind(n,6443)),"@site/docs/api/classes/IOttomanType.md",6443],"9c253f25":[()=>n.e(3910).then(n.bind(n,4616)),"@site/docs/api/classes/IndexParamsUsingGSIExceptions.md",4616],"9e39b1cd":[()=>n.e(7813).then(n.bind(n,3279)),"@site/docs/cli/cli.md",3279],"9ec0e5bc":[()=>n.e(9547).then(n.bind(n,4290)),"@site/docs/api/classes/StringType.md",4290],aeea3ecd:[()=>n.e(7157).then(n.bind(n,823)),"@site/docs/advanced/fts.md",823],af1b16ab:[()=>n.e(4312).then(n.t.bind(n,7085,19)),"/home/runner/work/node-ottoman/node-ottoman/docusaurus/.docusaurus/docusaurus-theme-search-algolia/default/plugin-route-context-module-100.json",7085],b87196ac:[()=>n.e(5474).then(n.bind(n,3831)),"@site/docs/api/classes/ValidationError.md",3831],ba211ef4:[()=>n.e(6635).then(n.bind(n,7570)),"@site/docs/api/classes/ManyQueryResponse.md",7570],bf248f05:[()=>n.e(6719).then(n.bind(n,3003)),"@site/docs/basic/document.md",3003],c2e30713:[()=>n.e(6647).then(n.bind(n,1449)),"@site/docs/api/interfaces/IStatusExecution.md",1449],c4f5d8e4:[()=>Promise.all([n.e(532),n.e(4195)]).then(n.bind(n,2926)),"@site/src/pages/index.js",2926],ca85dbe4:[()=>n.e(549).then(n.bind(n,2392)),"@site/docs/api/classes/ArrayType.md",2392],ccdd5768:[()=>n.e(2786).then(n.bind(n,8966)),"@site/docs/basic/ottoman.md",8966],d2bcc287:[()=>n.e(5182).then(n.bind(n,3449)),"@site/docs/basic/model.md",3449],dadfac7e:[()=>n.e(3190).then(n.t.bind(n,5745,19)),"/home/runner/work/node-ottoman/node-ottoman/docusaurus/.docusaurus/docusaurus-plugin-content-pages/default/plugin-route-context-module-100.json",5745],db501fe4:[()=>n.e(577).then(n.bind(n,7613)),"@site/docs/advanced/mongoose-to-couchbase.md",7613],df7f7ec8:[()=>n.e(1505).then(n.bind(n,3425)),"@site/docs/api/classes/Ottoman.md",3425],dfd5a0c2:[()=>n.e(6447).then(n.bind(n,6331)),"@site/docs/advanced/ottoman.md",6331],e2447885:[()=>n.e(1295).then(n.bind(n,5025)),"@site/docs/api/classes/NumberType.md",5025],edaeaefb:[()=>n.e(9309).then(n.bind(n,6417)),"@site/docs/api/classes/BooleanType.md",6417],f3182975:[()=>n.e(7679).then(n.bind(n,2523)),"@site/docs/api/interfaces/IIndexWithParams.md",2523],f45ac2d9:[()=>n.e(367).then(n.bind(n,5690)),"@site/docs/api/interfaces/IModel.md",5690],f60a93e3:[()=>n.e(6315).then(n.bind(n,3299)),"@site/docs/api/classes/SelectClauseException.md",3299],f6aebfbf:[()=>n.e(7306).then(n.bind(n,4440)),"@site/docs/api/modules.md",4440],f6e3c820:[()=>n.e(6058).then(n.bind(n,2901)),"@site/docs/api/classes/Query.md",2901],f6f984bd:[()=>n.e(2604).then(n.bind(n,2283)),"@site/docs/api/interfaces/ValidatorOption.md",2283],f837a72c:[()=>n.e(2835).then(n.bind(n,3889)),"@site/docs/api/interfaces/CreateModelOptions.md",3889],f9997bbb:[()=>n.e(3647).then(n.t.bind(n,3769,19)),"/home/runner/work/node-ottoman/node-ottoman/docusaurus/.docusaurus/docusaurus-plugin-content-docs/default/plugin-route-context-module-100.json",3769],fcde7231:[()=>n.e(5918).then(n.bind(n,1063)),"@site/docs/first-app.md",1063]};function c(e){let{error:t,retry:n,pastDelay:a}=e;return t?r.createElement("div",{style:{textAlign:"center",color:"#fff",backgroundColor:"#fa383e",borderColor:"#fa383e",borderStyle:"solid",borderRadius:"0.25rem",borderWidth:"1px",boxSizing:"border-box",display:"block",padding:"1rem",flex:"0 0 50%",marginLeft:"25%",marginRight:"25%",marginTop:"5rem",maxWidth:"50%",width:"100%"}},r.createElement("p",null,String(t)),r.createElement("div",null,r.createElement("button",{type:"button",onClick:n},"Retry"))):a?r.createElement("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"}},r.createElement("svg",{id:"loader",style:{width:128,height:110,position:"absolute",top:"calc(100vh - 64%)"},viewBox:"0 0 45 45",xmlns:"http://www.w3.org/2000/svg",stroke:"#61dafb"},r.createElement("g",{fill:"none",fillRule:"evenodd",transform:"translate(1 1)",strokeWidth:"2"},r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"1.5s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"1.5s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"1.5s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"6",strokeOpacity:"0"},r.createElement("animate",{attributeName:"r",begin:"3s",dur:"3s",values:"6;22",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-opacity",begin:"3s",dur:"3s",values:"1;0",calcMode:"linear",repeatCount:"indefinite"}),r.createElement("animate",{attributeName:"stroke-width",begin:"3s",dur:"3s",values:"2;0",calcMode:"linear",repeatCount:"indefinite"})),r.createElement("circle",{cx:"22",cy:"22",r:"8"},r.createElement("animate",{attributeName:"r",begin:"0s",dur:"1.5s",values:"6;1;2;3;4;5;6",calcMode:"linear",repeatCount:"indefinite"}))))):null}var u=n(9670),d=n(226);function p(e,t){if("*"===e)return i()({loading:c,loader:()=>n.e(4972).then(n.bind(n,4972)),modules:["@theme/NotFound"],webpack:()=>[4972],render(e,t){const n=e.default;return r.createElement(d.z,{value:{plugin:{name:"native",id:"default"}}},r.createElement(n,t))}});const o=l[`${e}-${t}`],p={},f=[],m=[],h=(0,u.Z)(o);return Object.entries(h).forEach((e=>{let[t,n]=e;const r=s[n];r&&(p[t]=r[0],f.push(r[1]),m.push(r[2]))})),i().Map({loading:c,loader:p,modules:f,webpack:()=>m,render(t,n){const i=JSON.parse(JSON.stringify(o));Object.entries(t).forEach((t=>{let[n,r]=t;const a=r.default;if(!a)throw new Error(`The page component at ${e} doesn't have a default export. This makes it impossible to render anything. Consider default-exporting a React component.`);"object"!=typeof a&&"function"!=typeof a||Object.keys(r).filter((e=>"default"!==e)).forEach((e=>{a[e]=r[e]}));let o=i;const l=n.split(".");l.slice(0,-1).forEach((e=>{o=o[e]})),o[l[l.length-1]]=a}));const l=i.__comp;delete i.__comp;const s=i.__context;return delete i.__context,r.createElement(d.z,{value:s},r.createElement(l,(0,a.Z)({},i,n)))}})}const f=[{path:"/markdown-page",component:p("/markdown-page","ec1"),exact:!0},{path:"/search",component:p("/search","617"),exact:!0},{path:"/docs",component:p("/docs","979"),routes:[{path:"/docs/advanced/fts",component:p("/docs/advanced/fts","8b7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/how-ottoman-works",component:p("/docs/advanced/how-ottoman-works","99d"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/mongoose-to-couchbase",component:p("/docs/advanced/mongoose-to-couchbase","8fd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/ottoman",component:p("/docs/advanced/ottoman","31e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/ottoman-couchbase",component:p("/docs/advanced/ottoman-couchbase","352"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/ottomanV1-to-ottomanV2",component:p("/docs/advanced/ottomanV1-to-ottomanV2","e71"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/sdk-comparison",component:p("/docs/advanced/sdk-comparison","8c9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/advanced/transactions",component:p("/docs/advanced/transactions","982"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api",component:p("/docs/api","c13"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/ArrayType",component:p("/docs/api/classes/ArrayType","10f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/BooleanType",component:p("/docs/api/classes/BooleanType","955"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/BuildSchemaError",component:p("/docs/api/classes/BuildSchemaError","85e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/CoreType",component:p("/docs/api/classes/CoreType","7db"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/DateType",component:p("/docs/api/classes/DateType","d83"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/Document",component:p("/docs/api/classes/Document","4db"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/EmbedType",component:p("/docs/api/classes/EmbedType","a9f"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/FindByIdOptions",component:p("/docs/api/classes/FindByIdOptions","ccd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/FindOptions",component:p("/docs/api/classes/FindOptions","cc6"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/IndexParamsOnExceptions",component:p("/docs/api/classes/IndexParamsOnExceptions","612"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/IndexParamsUsingGSIExceptions",component:p("/docs/api/classes/IndexParamsUsingGSIExceptions","c15"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/IOttomanType",component:p("/docs/api/classes/IOttomanType","f7b"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/ManyQueryResponse",component:p("/docs/api/classes/ManyQueryResponse","2cc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/MixedType",component:p("/docs/api/classes/MixedType","143"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/Model",component:p("/docs/api/classes/Model","1dc"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/MultipleQueryTypesException",component:p("/docs/api/classes/MultipleQueryTypesException","5b7"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/NumberType",component:p("/docs/api/classes/NumberType","b14"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/Ottoman",component:p("/docs/api/classes/Ottoman","604"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/Query",component:p("/docs/api/classes/Query","a83"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/QueryGroupByParamsException",component:p("/docs/api/classes/QueryGroupByParamsException","dc3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/QueryOperatorNotFoundException",component:p("/docs/api/classes/QueryOperatorNotFoundException","368"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/ReferenceType",component:p("/docs/api/classes/ReferenceType","6a2"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/Schema",component:p("/docs/api/classes/Schema","5ab"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/SelectClauseException",component:p("/docs/api/classes/SelectClauseException","1ad"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/StringType",component:p("/docs/api/classes/StringType","abd"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/ValidationError",component:p("/docs/api/classes/ValidationError","1c1"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/ViewIndexOptions",component:p("/docs/api/classes/ViewIndexOptions","6e4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/classes/WhereClauseException",component:p("/docs/api/classes/WhereClauseException","707"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/enums/SearchConsistency",component:p("/docs/api/enums/SearchConsistency","a28"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/enums/VALIDATION_STRATEGY",component:p("/docs/api/enums/VALIDATION_STRATEGY","171"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/CreateModelOptions",component:p("/docs/api/interfaces/CreateModelOptions","8b8"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/FindOneAndUpdateOption",component:p("/docs/api/interfaces/FindOneAndUpdateOption","d5a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/IConditionExpr",component:p("/docs/api/interfaces/IConditionExpr","6b3"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/IField",component:p("/docs/api/interfaces/IField","5ce"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/IIndexOnParams",component:p("/docs/api/interfaces/IIndexOnParams","ff0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/IIndexWithParams",component:p("/docs/api/interfaces/IIndexWithParams","fdb"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/IManyQueryResponse",component:p("/docs/api/interfaces/IManyQueryResponse","8fe"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/IModel",component:p("/docs/api/interfaces/IModel","486"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/IStatusExecution",component:p("/docs/api/interfaces/IStatusExecution","199"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/ModelOptions",component:p("/docs/api/interfaces/ModelOptions","cc4"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/saveOptions",component:p("/docs/api/interfaces/saveOptions","3c9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/UpdateManyOptions",component:p("/docs/api/interfaces/UpdateManyOptions","c45"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/interfaces/ValidatorOption",component:p("/docs/api/interfaces/ValidatorOption","cc9"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/api/modules",component:p("/docs/api/modules","98a"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basic/document",component:p("/docs/basic/document","942"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basic/model",component:p("/docs/basic/model","9fe"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basic/ottoman",component:p("/docs/basic/ottoman","c9e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basic/query-builder",component:p("/docs/basic/query-builder","1f0"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/basic/schema",component:p("/docs/basic/schema","61e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/cli",component:p("/docs/cli","4ff"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/faq",component:p("/docs/faq","e79"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/first-app",component:p("/docs/first-app","a3e"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/intro",component:p("/docs/intro","aed"),exact:!0,sidebar:"tutorialSidebar"},{path:"/docs/quick-start",component:p("/docs/quick-start","a57"),exact:!0,sidebar:"tutorialSidebar"}]},{path:"/",component:p("/","a15"),exact:!0},{path:"*",component:p("*")}]},8934:(e,t,n)=>{"use strict";n.d(t,{_:()=>a,t:()=>o});var r=n(7294);const a=r.createContext(!1);function o(e){let{children:t}=e;const[n,o]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{o(!0)}),[]),r.createElement(a.Provider,{value:n},t)}},9383:(e,t,n)=>{"use strict";var r=n(7294),a=n(3935),o=n(3727),i=n(405),l=n(412);const s=[n(2497),n(3310),n(8320),n(2295)];var c=n(723),u=n(6550),d=n(8790);function p(e){let{children:t}=e;return r.createElement(r.Fragment,null,t)}var f=n(7462),m=n(5742),h=n(2263),g=n(4996),b=n(6668),v=n(833),y=n(4711),w=n(9727),k=n(3320),E=n(197);function S(){const{i18n:{defaultLocale:e,localeConfigs:t}}=(0,h.Z)(),n=(0,y.l)();return r.createElement(m.Z,null,Object.entries(t).map((e=>{let[t,{htmlLang:a}]=e;return r.createElement("link",{key:t,rel:"alternate",href:n.createUrl({locale:t,fullyQualified:!0}),hrefLang:a})})),r.createElement("link",{rel:"alternate",href:n.createUrl({locale:e,fullyQualified:!0}),hrefLang:"x-default"}))}function x(e){let{permalink:t}=e;const{siteConfig:{url:n}}=(0,h.Z)(),a=function(){const{siteConfig:{url:e}}=(0,h.Z)(),{pathname:t}=(0,u.TH)();return e+(0,g.Z)(t)}(),o=t?`${n}${t}`:a;return r.createElement(m.Z,null,r.createElement("meta",{property:"og:url",content:o}),r.createElement("link",{rel:"canonical",href:o}))}function T(){const{i18n:{currentLocale:e}}=(0,h.Z)(),{metadata:t,image:n}=(0,b.L)();return r.createElement(r.Fragment,null,r.createElement(m.Z,null,r.createElement("meta",{name:"twitter:card",content:"summary_large_image"}),r.createElement("body",{className:w.h})),n&&r.createElement(v.d,{image:n}),r.createElement(x,null),r.createElement(S,null),r.createElement(E.Z,{tag:k.HX,locale:e}),r.createElement(m.Z,null,t.map(((e,t)=>r.createElement("meta",(0,f.Z)({key:t},e))))))}const C=new Map;function _(e){if(C.has(e.pathname))return{...e,pathname:C.get(e.pathname)};if((0,d.f)(c.Z,e.pathname).some((e=>{let{route:t}=e;return!0===t.exact})))return C.set(e.pathname,e.pathname),e;const t=e.pathname.trim().replace(/(?:\/index)?\.html$/,"")||"/";return C.set(e.pathname,t),{...e,pathname:t}}var A=n(8934),O=n(8940);function R(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r{var r;const a=(null==(r=t.default)?void 0:r[e])??t[e];return null==a?void 0:a(...n)}));return()=>a.forEach((e=>null==e?void 0:e()))}const L=function(e){let{children:t,location:n,previousLocation:a}=e;return(0,r.useLayoutEffect)((()=>{a!==n&&(!function(e){let{location:t,previousLocation:n}=e;if(!n)return;const r=t.pathname===n.pathname,a=t.hash===n.hash,o=t.search===n.search;if(r&&a&&!o)return;const{hash:i}=t;if(i){const e=decodeURIComponent(i.substring(1)),t=document.getElementById(e);null==t||t.scrollIntoView()}else window.scrollTo(0,0)}({location:n,previousLocation:a}),R("onRouteDidUpdate",{previousLocation:a,location:n}))}),[a,n]),t};function I(e){const t=Array.from(new Set([e,decodeURI(e)])).map((e=>(0,d.f)(c.Z,e))).flat();return Promise.all(t.map((e=>null==e.route.component.preload?void 0:e.route.component.preload())))}class P extends r.Component{constructor(e){super(e),this.previousLocation=void 0,this.routeUpdateCleanupCb=void 0,this.previousLocation=null,this.routeUpdateCleanupCb=l.Z.canUseDOM?R("onRouteUpdate",{previousLocation:null,location:this.props.location}):()=>{},this.state={nextRouteHasLoaded:!0}}shouldComponentUpdate(e,t){if(e.location===this.props.location)return t.nextRouteHasLoaded;const n=e.location;return this.previousLocation=this.props.location,this.setState({nextRouteHasLoaded:!1}),this.routeUpdateCleanupCb=R("onRouteUpdate",{previousLocation:this.previousLocation,location:n}),I(n.pathname).then((()=>{this.routeUpdateCleanupCb(),this.setState({nextRouteHasLoaded:!0})})).catch((e=>{console.warn(e),window.location.reload()})),!1}render(){const{children:e,location:t}=this.props;return r.createElement(L,{previousLocation:this.previousLocation,location:t},r.createElement(u.AW,{location:t,render:()=>e}))}}const N=P,D="__docusaurus-base-url-issue-banner-container",M="__docusaurus-base-url-issue-banner-suggestion-container",F="__DOCUSAURUS_INSERT_BASEURL_BANNER";function B(e){return`\nwindow['${F}'] = true;\n\ndocument.addEventListener('DOMContentLoaded', maybeInsertBanner);\n\nfunction maybeInsertBanner() {\n var shouldInsert = window['${F}'];\n shouldInsert && insertBanner();\n}\n\nfunction insertBanner() {\n var bannerContainer = document.getElementById('${D}');\n if (!bannerContainer) {\n return;\n }\n var bannerHtml = ${JSON.stringify(function(e){return`\n
\n

Your Docusaurus site did not load properly.

\n

A very common reason is a wrong site baseUrl configuration.

\n

Current configured baseUrl = ${e} ${"/"===e?" (default value)":""}

\n

We suggest trying baseUrl =

\n
\n`}(e)).replace(/{window[F]=!1}),[]),r.createElement(r.Fragment,null,!l.Z.canUseDOM&&r.createElement(m.Z,null,r.createElement("script",null,B(e))),r.createElement("div",{id:D}))}function U(){const{siteConfig:{baseUrl:e,baseUrlIssueBanner:t}}=(0,h.Z)(),{pathname:n}=(0,u.TH)();return t&&n===e?r.createElement(j,null):null}function z(){const{siteConfig:{favicon:e,title:t,noIndex:n},i18n:{currentLocale:a,localeConfigs:o}}=(0,h.Z)(),i=(0,g.Z)(e),{htmlLang:l,direction:s}=o[a];return r.createElement(m.Z,null,r.createElement("html",{lang:l,dir:s}),r.createElement("title",null,t),r.createElement("meta",{property:"og:title",content:t}),r.createElement("meta",{name:"viewport",content:"width=device-width, initial-scale=1.0"}),n&&r.createElement("meta",{name:"robots",content:"noindex, nofollow"}),e&&r.createElement("link",{rel:"icon",href:i}))}var $=n(4763);function q(){const e=(0,d.H)(c.Z),t=(0,u.TH)();return r.createElement($.Z,null,r.createElement(O.M,null,r.createElement(A.t,null,r.createElement(p,null,r.createElement(z,null),r.createElement(T,null),r.createElement(U,null),r.createElement(N,{location:_(t)},e)))))}var G=n(6887);const H=function(e){try{return document.createElement("link").relList.supports(e)}catch{return!1}}("prefetch")?function(e){return new Promise(((t,n)=>{var r;if("undefined"==typeof document)return void n();const a=document.createElement("link");a.setAttribute("rel","prefetch"),a.setAttribute("href",e),a.onload=()=>t(),a.onerror=()=>n();const o=document.getElementsByTagName("head")[0]??(null==(r=document.getElementsByName("script")[0])?void 0:r.parentNode);null==o||o.appendChild(a)}))}:function(e){return new Promise(((t,n)=>{const r=new XMLHttpRequest;r.open("GET",e,!0),r.withCredentials=!0,r.onload=()=>{200===r.status?t():n()},r.send(null)}))};var Z=n(9670);const V=new Set,W=new Set,Q=()=>{var e,t;return(null==(e=navigator.connection)?void 0:e.effectiveType.includes("2g"))||(null==(t=navigator.connection)?void 0:t.saveData)},K={prefetch(e){if(!(e=>!Q()&&!W.has(e)&&!V.has(e))(e))return!1;V.add(e);const t=(0,d.f)(c.Z,e).flatMap((e=>{return t=e.route.path,Object.entries(G).filter((e=>{let[n]=e;return n.replace(/-[^-]+$/,"")===t})).flatMap((e=>{let[,t]=e;return Object.values((0,Z.Z)(t))}));var t}));return Promise.all(t.map((e=>{const t=n.gca(e);return t&&!t.includes("undefined")?H(t).catch((()=>{})):Promise.resolve()})))},preload:e=>!!(e=>!Q()&&!W.has(e))(e)&&(W.add(e),I(e))},Y=Object.freeze(K);if(l.Z.canUseDOM){window.docusaurus=Y;const e=a.hydrate;I(window.location.pathname).then((()=>{e(r.createElement(i.B6,null,r.createElement(o.VK,null,r.createElement(q,null))),document.getElementById("__docusaurus"))}))}},8940:(e,t,n)=>{"use strict";n.d(t,{_:()=>u,M:()=>d});var r=n(7294),a=n(6809);const o=JSON.parse('{"docusaurus-plugin-content-docs":{"default":{"path":"/docs","versions":[{"name":"current","label":"Next","isLast":true,"path":"/docs","mainDocId":"intro","docs":[{"id":"advanced/fts","path":"/docs/advanced/fts","sidebar":"tutorialSidebar"},{"id":"advanced/how-ottoman-works","path":"/docs/advanced/how-ottoman-works","sidebar":"tutorialSidebar"},{"id":"advanced/mongoose-to-couchbase","path":"/docs/advanced/mongoose-to-couchbase","sidebar":"tutorialSidebar"},{"id":"advanced/ottoman","path":"/docs/advanced/ottoman","sidebar":"tutorialSidebar"},{"id":"advanced/ottoman-couchbase","path":"/docs/advanced/ottoman-couchbase","sidebar":"tutorialSidebar"},{"id":"advanced/ottomanV1-to-ottomanV2","path":"/docs/advanced/ottomanV1-to-ottomanV2","sidebar":"tutorialSidebar"},{"id":"advanced/sdk-comparison","path":"/docs/advanced/sdk-comparison","sidebar":"tutorialSidebar"},{"id":"advanced/transactions","path":"/docs/advanced/transactions","sidebar":"tutorialSidebar"},{"id":"api/classes/ArrayType","path":"/docs/api/classes/ArrayType","sidebar":"tutorialSidebar"},{"id":"api/classes/BooleanType","path":"/docs/api/classes/BooleanType","sidebar":"tutorialSidebar"},{"id":"api/classes/BuildSchemaError","path":"/docs/api/classes/BuildSchemaError","sidebar":"tutorialSidebar"},{"id":"api/classes/CoreType","path":"/docs/api/classes/CoreType","sidebar":"tutorialSidebar"},{"id":"api/classes/DateType","path":"/docs/api/classes/DateType","sidebar":"tutorialSidebar"},{"id":"api/classes/Document","path":"/docs/api/classes/Document","sidebar":"tutorialSidebar"},{"id":"api/classes/EmbedType","path":"/docs/api/classes/EmbedType","sidebar":"tutorialSidebar"},{"id":"api/classes/FindByIdOptions","path":"/docs/api/classes/FindByIdOptions","sidebar":"tutorialSidebar"},{"id":"api/classes/FindOptions","path":"/docs/api/classes/FindOptions","sidebar":"tutorialSidebar"},{"id":"api/classes/IndexParamsOnExceptions","path":"/docs/api/classes/IndexParamsOnExceptions","sidebar":"tutorialSidebar"},{"id":"api/classes/IndexParamsUsingGSIExceptions","path":"/docs/api/classes/IndexParamsUsingGSIExceptions","sidebar":"tutorialSidebar"},{"id":"api/classes/IOttomanType","path":"/docs/api/classes/IOttomanType","sidebar":"tutorialSidebar"},{"id":"api/classes/ManyQueryResponse","path":"/docs/api/classes/ManyQueryResponse","sidebar":"tutorialSidebar"},{"id":"api/classes/MixedType","path":"/docs/api/classes/MixedType","sidebar":"tutorialSidebar"},{"id":"api/classes/Model","path":"/docs/api/classes/Model","sidebar":"tutorialSidebar"},{"id":"api/classes/MultipleQueryTypesException","path":"/docs/api/classes/MultipleQueryTypesException","sidebar":"tutorialSidebar"},{"id":"api/classes/NumberType","path":"/docs/api/classes/NumberType","sidebar":"tutorialSidebar"},{"id":"api/classes/Ottoman","path":"/docs/api/classes/Ottoman","sidebar":"tutorialSidebar"},{"id":"api/classes/Query","path":"/docs/api/classes/Query","sidebar":"tutorialSidebar"},{"id":"api/classes/QueryGroupByParamsException","path":"/docs/api/classes/QueryGroupByParamsException","sidebar":"tutorialSidebar"},{"id":"api/classes/QueryOperatorNotFoundException","path":"/docs/api/classes/QueryOperatorNotFoundException","sidebar":"tutorialSidebar"},{"id":"api/classes/ReferenceType","path":"/docs/api/classes/ReferenceType","sidebar":"tutorialSidebar"},{"id":"api/classes/Schema","path":"/docs/api/classes/Schema","sidebar":"tutorialSidebar"},{"id":"api/classes/SelectClauseException","path":"/docs/api/classes/SelectClauseException","sidebar":"tutorialSidebar"},{"id":"api/classes/StringType","path":"/docs/api/classes/StringType","sidebar":"tutorialSidebar"},{"id":"api/classes/ValidationError","path":"/docs/api/classes/ValidationError","sidebar":"tutorialSidebar"},{"id":"api/classes/ViewIndexOptions","path":"/docs/api/classes/ViewIndexOptions","sidebar":"tutorialSidebar"},{"id":"api/classes/WhereClauseException","path":"/docs/api/classes/WhereClauseException","sidebar":"tutorialSidebar"},{"id":"api/enums/SearchConsistency","path":"/docs/api/enums/SearchConsistency","sidebar":"tutorialSidebar"},{"id":"api/enums/VALIDATION_STRATEGY","path":"/docs/api/enums/VALIDATION_STRATEGY","sidebar":"tutorialSidebar"},{"id":"api/index","path":"/docs/api/","sidebar":"tutorialSidebar"},{"id":"api/interfaces/CreateModelOptions","path":"/docs/api/interfaces/CreateModelOptions","sidebar":"tutorialSidebar"},{"id":"api/interfaces/FindOneAndUpdateOption","path":"/docs/api/interfaces/FindOneAndUpdateOption","sidebar":"tutorialSidebar"},{"id":"api/interfaces/IConditionExpr","path":"/docs/api/interfaces/IConditionExpr","sidebar":"tutorialSidebar"},{"id":"api/interfaces/IField","path":"/docs/api/interfaces/IField","sidebar":"tutorialSidebar"},{"id":"api/interfaces/IIndexOnParams","path":"/docs/api/interfaces/IIndexOnParams","sidebar":"tutorialSidebar"},{"id":"api/interfaces/IIndexWithParams","path":"/docs/api/interfaces/IIndexWithParams","sidebar":"tutorialSidebar"},{"id":"api/interfaces/IManyQueryResponse","path":"/docs/api/interfaces/IManyQueryResponse","sidebar":"tutorialSidebar"},{"id":"api/interfaces/IModel","path":"/docs/api/interfaces/IModel","sidebar":"tutorialSidebar"},{"id":"api/interfaces/IStatusExecution","path":"/docs/api/interfaces/IStatusExecution","sidebar":"tutorialSidebar"},{"id":"api/interfaces/ModelOptions","path":"/docs/api/interfaces/ModelOptions","sidebar":"tutorialSidebar"},{"id":"api/interfaces/saveOptions","path":"/docs/api/interfaces/saveOptions","sidebar":"tutorialSidebar"},{"id":"api/interfaces/UpdateManyOptions","path":"/docs/api/interfaces/UpdateManyOptions","sidebar":"tutorialSidebar"},{"id":"api/interfaces/ValidatorOption","path":"/docs/api/interfaces/ValidatorOption","sidebar":"tutorialSidebar"},{"id":"api/modules","path":"/docs/api/modules","sidebar":"tutorialSidebar"},{"id":"basic/document","path":"/docs/basic/document","sidebar":"tutorialSidebar"},{"id":"basic/model","path":"/docs/basic/model","sidebar":"tutorialSidebar"},{"id":"basic/ottoman","path":"/docs/basic/ottoman","sidebar":"tutorialSidebar"},{"id":"basic/query-builder","path":"/docs/basic/query-builder","sidebar":"tutorialSidebar"},{"id":"basic/schema","path":"/docs/basic/schema","sidebar":"tutorialSidebar"},{"id":"cli/cli","path":"/docs/cli/","sidebar":"tutorialSidebar"},{"id":"faq","path":"/docs/faq","sidebar":"tutorialSidebar"},{"id":"first-app","path":"/docs/first-app","sidebar":"tutorialSidebar"},{"id":"intro","path":"/docs/intro","sidebar":"tutorialSidebar"},{"id":"quick-start","path":"/docs/quick-start","sidebar":"tutorialSidebar"}],"draftIds":[],"sidebars":{"tutorialSidebar":{"link":{"path":"/docs/intro","label":"intro"}}}}],"breadcrumbs":true}}}'),i=JSON.parse('{"defaultLocale":"en","locales":["en"],"path":"i18n","currentLocale":"en","localeConfigs":{"en":{"label":"English","direction":"ltr","htmlLang":"en","calendar":"gregory","path":"en"}}}');var l=n(7529);const s=JSON.parse('{"docusaurusVersion":"2.4.1","siteVersion":"0.0.0","pluginVersions":{"docusaurus-plugin-content-docs":{"type":"package","name":"@docusaurus/plugin-content-docs","version":"2.4.1"},"docusaurus-plugin-content-blog":{"type":"package","name":"@docusaurus/plugin-content-blog","version":"2.4.1"},"docusaurus-plugin-content-pages":{"type":"package","name":"@docusaurus/plugin-content-pages","version":"2.4.1"},"docusaurus-plugin-sitemap":{"type":"package","name":"@docusaurus/plugin-sitemap","version":"2.4.1"},"docusaurus-theme-classic":{"type":"package","name":"@docusaurus/theme-classic","version":"2.4.1"},"docusaurus-theme-search-algolia":{"type":"package","name":"@docusaurus/theme-search-algolia","version":"2.4.1"},"docusaurus-plugin-typedoc":{"type":"package","name":"docusaurus-plugin-typedoc","version":"0.17.5"}}}'),c={siteConfig:a.default,siteMetadata:s,globalData:o,i18n:i,codeTranslations:l},u=r.createContext(c);function d(e){let{children:t}=e;return r.createElement(u.Provider,{value:c},t)}},4763:(e,t,n)=>{"use strict";n.d(t,{Z:()=>p});var r=n(7294),a=n(412),o=n(5742),i=n(8780),l=n(7452);function s(e){let{error:t,tryAgain:n}=e;return r.createElement("div",{style:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"flex-start",minHeight:"100vh",width:"100%",maxWidth:"80ch",fontSize:"20px",margin:"0 auto",padding:"1rem"}},r.createElement("h1",{style:{fontSize:"3rem"}},"This page crashed"),r.createElement("button",{type:"button",onClick:n,style:{margin:"1rem 0",fontSize:"2rem",cursor:"pointer",borderRadius:20,padding:"1rem"}},"Try again"),r.createElement(c,{error:t}))}function c(e){let{error:t}=e;const n=(0,i.getErrorCausalChain)(t).map((e=>e.message)).join("\n\nCause:\n");return r.createElement("p",{style:{whiteSpace:"pre-wrap"}},n)}function u(e){let{error:t,tryAgain:n}=e;return r.createElement(p,{fallback:()=>r.createElement(s,{error:t,tryAgain:n})},r.createElement(o.Z,null,r.createElement("title",null,"Page Error")),r.createElement(l.Z,null,r.createElement(s,{error:t,tryAgain:n})))}const d=e=>r.createElement(u,e);class p extends r.Component{constructor(e){super(e),this.state={error:null}}componentDidCatch(e){a.Z.canUseDOM&&this.setState({error:e})}render(){const{children:e}=this.props,{error:t}=this.state;if(t){const e={error:t,tryAgain:()=>this.setState({error:null})};return(this.props.fallback??d)(e)}return e??null}}},412:(e,t,n)=>{"use strict";n.d(t,{Z:()=>a});const r="undefined"!=typeof window&&"document"in window&&"createElement"in window.document,a={canUseDOM:r,canUseEventListeners:r&&("addEventListener"in window||"attachEvent"in window),canUseIntersectionObserver:r&&"IntersectionObserver"in window,canUseViewport:r&&"screen"in window}},5742:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(405);function o(e){return r.createElement(a.ql,e)}},9960:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(7462),a=n(7294),o=n(3727),i=n(8780),l=n(2263),s=n(3919),c=n(412);const u=a.createContext({collectLink:()=>{}});var d=n(4996);function p(e,t){var n;let{isNavLink:p,to:f,href:m,activeClassName:h,isActive:g,"data-noBrokenLinkCheck":b,autoAddBaseUrl:v=!0,...y}=e;const{siteConfig:{trailingSlash:w,baseUrl:k}}=(0,l.Z)(),{withBaseUrl:E}=(0,d.C)(),S=(0,a.useContext)(u),x=(0,a.useRef)(null);(0,a.useImperativeHandle)(t,(()=>x.current));const T=f||m;const C=(0,s.Z)(T),_=null==T?void 0:T.replace("pathname://","");let A=void 0!==_?(O=_,v&&(e=>e.startsWith("/"))(O)?E(O):O):void 0;var O;A&&C&&(A=(0,i.applyTrailingSlash)(A,{trailingSlash:w,baseUrl:k}));const R=(0,a.useRef)(!1),L=p?o.OL:o.rU,I=c.Z.canUseIntersectionObserver,P=(0,a.useRef)(),N=()=>{R.current||null==A||(window.docusaurus.preload(A),R.current=!0)};(0,a.useEffect)((()=>(!I&&C&&null!=A&&window.docusaurus.prefetch(A),()=>{I&&P.current&&P.current.disconnect()})),[P,A,I,C]);const D=(null==(n=A)?void 0:n.startsWith("#"))??!1,M=!A||!C||D;return M||b||S.collectLink(A),M?a.createElement("a",(0,r.Z)({ref:x,href:A},T&&!C&&{target:"_blank",rel:"noopener noreferrer"},y)):a.createElement(L,(0,r.Z)({},y,{onMouseEnter:N,onTouchStart:N,innerRef:e=>{x.current=e,I&&e&&C&&(P.current=new window.IntersectionObserver((t=>{t.forEach((t=>{e===t.target&&(t.isIntersecting||t.intersectionRatio>0)&&(P.current.unobserve(e),P.current.disconnect(),null!=A&&window.docusaurus.prefetch(A))}))})),P.current.observe(e))},to:A},p&&{isActive:g,activeClassName:h}))}const f=a.forwardRef(p)},5999:(e,t,n)=>{"use strict";n.d(t,{Z:()=>s,I:()=>l});var r=n(7294);function a(e,t){const n=e.split(/(\{\w+\})/).map(((e,n)=>{if(n%2==1){const n=null==t?void 0:t[e.slice(1,-1)];if(void 0!==n)return n}return e}));return n.some((e=>(0,r.isValidElement)(e)))?n.map(((e,t)=>(0,r.isValidElement)(e)?r.cloneElement(e,{key:t}):e)).filter((e=>""!==e)):n.join("")}var o=n(7529);function i(e){let{id:t,message:n}=e;if(void 0===t&&void 0===n)throw new Error("Docusaurus translation declarations must have at least a translation id or a default translation message");return o[t??n]??n??t}function l(e,t){let{message:n,id:r}=e;return a(i({message:n,id:r}),t)}function s(e){let{children:t,id:n,values:o}=e;if(t&&"string"!=typeof t)throw console.warn("Illegal children",t),new Error("The Docusaurus component only accept simple string values");const l=i({message:t,id:n});return r.createElement(r.Fragment,null,a(l,o))}},9935:(e,t,n)=>{"use strict";n.d(t,{m:()=>r});const r="default"},3919:(e,t,n)=>{"use strict";function r(e){return/^(?:\w*:|\/\/)/.test(e)}function a(e){return void 0!==e&&!r(e)}n.d(t,{Z:()=>a,b:()=>r})},4996:(e,t,n)=>{"use strict";n.d(t,{C:()=>i,Z:()=>l});var r=n(7294),a=n(2263),o=n(3919);function i(){const{siteConfig:{baseUrl:e,url:t}}=(0,a.Z)(),n=(0,r.useCallback)(((n,r)=>function(e,t,n,r){let{forcePrependBaseUrl:a=!1,absolute:i=!1}=void 0===r?{}:r;if(!n||n.startsWith("#")||(0,o.b)(n))return n;if(a)return t+n.replace(/^\//,"");if(n===t.replace(/\/$/,""))return t;const l=n.startsWith(t)?n:t+n.replace(/^\//,"");return i?e+l:l}(t,e,n,r)),[t,e]);return{withBaseUrl:n}}function l(e,t){void 0===t&&(t={});const{withBaseUrl:n}=i();return n(e,t)}},2263:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(8940);function o(){return(0,r.useContext)(a._)}},2389:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(8934);function o(){return(0,r.useContext)(a._)}},9670:(e,t,n)=>{"use strict";n.d(t,{Z:()=>r});function r(e){const t={};return function e(n,r){Object.entries(n).forEach((n=>{let[a,o]=n;const i=r?`${r}.${a}`:a;var l;"object"==typeof(l=o)&&l&&Object.keys(l).length>0?e(o,i):t[i]=o}))}(e),t}},226:(e,t,n)=>{"use strict";n.d(t,{_:()=>a,z:()=>o});var r=n(7294);const a=r.createContext(null);function o(e){let{children:t,value:n}=e;const o=r.useContext(a),i=(0,r.useMemo)((()=>function(e){let{parent:t,value:n}=e;if(!t){if(!n)throw new Error("Unexpected: no Docusaurus route context found");if(!("plugin"in n))throw new Error("Unexpected: Docusaurus topmost route context has no `plugin` attribute");return n}const r={...t.data,...null==n?void 0:n.data};return{plugin:t.plugin,data:r}}({parent:o,value:n})),[o,n]);return r.createElement(a.Provider,{value:i},t)}},143:(e,t,n)=>{"use strict";n.d(t,{Iw:()=>b,gA:()=>f,WS:()=>m,_r:()=>d,Jo:()=>v,zh:()=>p,yW:()=>g,gB:()=>h});var r=n(6550),a=n(2263),o=n(9935);function i(e,t){void 0===t&&(t={});const n=function(){const{globalData:e}=(0,a.Z)();return e}()[e];if(!n&&t.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin.`);return n}const l=e=>e.versions.find((e=>e.isLast));function s(e,t){const n=l(e);return[...e.versions.filter((e=>e!==n)),n].find((e=>!!(0,r.LX)(t,{path:e.path,exact:!1,strict:!1})))}function c(e,t){const n=s(e,t),a=null==n?void 0:n.docs.find((e=>!!(0,r.LX)(t,{path:e.path,exact:!0,strict:!1})));return{activeVersion:n,activeDoc:a,alternateDocVersions:a?function(t){const n={};return e.versions.forEach((e=>{e.docs.forEach((r=>{r.id===t&&(n[e.name]=r)}))})),n}(a.id):{}}}const u={},d=()=>i("docusaurus-plugin-content-docs")??u,p=e=>function(e,t,n){void 0===t&&(t=o.m),void 0===n&&(n={});const r=i(e),a=null==r?void 0:r[t];if(!a&&n.failfast)throw new Error(`Docusaurus plugin global data not found for "${e}" plugin with id "${t}".`);return a}("docusaurus-plugin-content-docs",e,{failfast:!0});function f(e){void 0===e&&(e={});const t=d(),{pathname:n}=(0,r.TH)();return function(e,t,n){void 0===n&&(n={});const a=Object.entries(e).sort(((e,t)=>t[1].path.localeCompare(e[1].path))).find((e=>{let[,n]=e;return!!(0,r.LX)(t,{path:n.path,exact:!1,strict:!1})})),o=a?{pluginId:a[0],pluginData:a[1]}:void 0;if(!o&&n.failfast)throw new Error(`Can't find active docs plugin for "${t}" pathname, while it was expected to be found. Maybe you tried to use a docs feature that can only be used on a docs-related page? Existing docs plugin paths are: ${Object.values(e).map((e=>e.path)).join(", ")}`);return o}(t,n,e)}function m(e){void 0===e&&(e={});const t=f(e),{pathname:n}=(0,r.TH)();if(!t)return;return{activePlugin:t,activeVersion:s(t.pluginData,n)}}function h(e){return p(e).versions}function g(e){const t=p(e);return l(t)}function b(e){const t=p(e),{pathname:n}=(0,r.TH)();return c(t,n)}function v(e){const t=p(e),{pathname:n}=(0,r.TH)();return function(e,t){const n=l(e);return{latestDocSuggestion:c(e,t).alternateDocVersions[n.name],latestVersionSuggestion:n}}(t,n)}},8320:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>o});var r=n(4865),a=n.n(r);a().configure({showSpinner:!1});const o={onRouteUpdate(e){let{location:t,previousLocation:n}=e;if(n&&t.pathname!==n.pathname){const e=window.setTimeout((()=>{a().start()}),200);return()=>window.clearTimeout(e)}},onRouteDidUpdate(){a().done()}}},3310:(e,t,n)=>{"use strict";n.r(t);var r=n(7410),a=n(6809);!function(e){const{themeConfig:{prism:t}}=a.default,{additionalLanguages:r}=t;globalThis.Prism=e,r.forEach((e=>{n(6726)(`./prism-${e}`)})),delete globalThis.Prism}(r.Z)},9471:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294);const a="iconExternalLink_nPIU";function o(e){let{width:t=13.5,height:n=13.5}=e;return r.createElement("svg",{width:t,height:n,"aria-hidden":"true",viewBox:"0 0 24 24",className:a},r.createElement("path",{fill:"currentColor",d:"M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z"}))}},7452:(e,t,n)=>{"use strict";n.d(t,{Z:()=>Pt});var r=n(7294),a=n(6010),o=n(4763),i=n(833),l=n(7462),s=n(6550),c=n(5999),u=n(5936);const d="__docusaurus_skipToContent_fallback";function p(e){e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")}function f(){const e=(0,r.useRef)(null),{action:t}=(0,s.k6)(),n=(0,r.useCallback)((e=>{e.preventDefault();const t=document.querySelector("main:first-of-type")??document.getElementById(d);t&&p(t)}),[]);return(0,u.S)((n=>{let{location:r}=n;e.current&&!r.hash&&"PUSH"===t&&p(e.current)})),{containerRef:e,onClick:n}}const m=(0,c.I)({id:"theme.common.skipToMainContent",description:"The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation",message:"Skip to main content"});function h(e){const t=e.children??m,{containerRef:n,onClick:a}=f();return r.createElement("div",{ref:n,role:"region","aria-label":m},r.createElement("a",(0,l.Z)({},e,{href:`#${d}`,onClick:a}),t))}var g=n(5281),b=n(9727);const v="skipToContent_fXgn";function y(){return r.createElement(h,{className:v})}var w=n(6668),k=n(9689);function E(e){let{width:t=21,height:n=21,color:a="currentColor",strokeWidth:o=1.2,className:i,...s}=e;return r.createElement("svg",(0,l.Z)({viewBox:"0 0 15 15",width:t,height:n},s),r.createElement("g",{stroke:a,strokeWidth:o},r.createElement("path",{d:"M.75.75l13.5 13.5M14.25.75L.75 14.25"})))}const S="closeButton_CVFx";function x(e){return r.createElement("button",(0,l.Z)({type:"button","aria-label":(0,c.I)({id:"theme.AnnouncementBar.closeButtonAriaLabel",message:"Close",description:"The ARIA label for close button of announcement bar"})},e,{className:(0,a.Z)("clean-btn close",S,e.className)}),r.createElement(E,{width:14,height:14,strokeWidth:3.1}))}const T="content_knG7";function C(e){const{announcementBar:t}=(0,w.L)(),{content:n}=t;return r.createElement("div",(0,l.Z)({},e,{className:(0,a.Z)(T,e.className),dangerouslySetInnerHTML:{__html:n}}))}const _="announcementBar_mb4j",A="announcementBarPlaceholder_vyr4",O="announcementBarClose_gvF7",R="announcementBarContent_xLdY";function L(){const{announcementBar:e}=(0,w.L)(),{isActive:t,close:n}=(0,k.nT)();if(!t)return null;const{backgroundColor:a,textColor:o,isCloseable:i}=e;return r.createElement("div",{className:_,style:{backgroundColor:a,color:o},role:"banner"},i&&r.createElement("div",{className:A}),r.createElement(C,{className:R}),i&&r.createElement(x,{onClick:n,className:O}))}var I=n(3163),P=n(2466);var N=n(902),D=n(3102);const M=r.createContext(null);function F(e){let{children:t}=e;const n=function(){const e=(0,I.e)(),t=(0,D.HY)(),[n,a]=(0,r.useState)(!1),o=null!==t.component,i=(0,N.D9)(o);return(0,r.useEffect)((()=>{o&&!i&&a(!0)}),[o,i]),(0,r.useEffect)((()=>{o?e.shown||a(!0):a(!1)}),[e.shown,o]),(0,r.useMemo)((()=>[n,a]),[n])}();return r.createElement(M.Provider,{value:n},t)}function B(e){if(e.component){const t=e.component;return r.createElement(t,e.props)}}function j(){const e=(0,r.useContext)(M);if(!e)throw new N.i6("NavbarSecondaryMenuDisplayProvider");const[t,n]=e,a=(0,r.useCallback)((()=>n(!1)),[n]),o=(0,D.HY)();return(0,r.useMemo)((()=>({shown:t,hide:a,content:B(o)})),[a,o,t])}function U(e){let{header:t,primaryMenu:n,secondaryMenu:o}=e;const{shown:i}=j();return r.createElement("div",{className:"navbar-sidebar"},t,r.createElement("div",{className:(0,a.Z)("navbar-sidebar__items",{"navbar-sidebar__items--show-secondary":i})},r.createElement("div",{className:"navbar-sidebar__item menu"},n),r.createElement("div",{className:"navbar-sidebar__item menu"},o)))}var z=n(2949),$=n(2389);function q(e){return r.createElement("svg",(0,l.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,7c-2.76,0-5,2.24-5,5s2.24,5,5,5s5-2.24,5-5 S14.76,7,12,7L12,7z M2,13l2,0c0.55,0,1-0.45,1-1s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S1.45,13,2,13z M20,13l2,0c0.55,0,1-0.45,1-1 s-0.45-1-1-1l-2,0c-0.55,0-1,0.45-1,1S19.45,13,20,13z M11,2v2c0,0.55,0.45,1,1,1s1-0.45,1-1V2c0-0.55-0.45-1-1-1S11,1.45,11,2z M11,20v2c0,0.55,0.45,1,1,1s1-0.45,1-1v-2c0-0.55-0.45-1-1-1C11.45,19,11,19.45,11,20z M5.99,4.58c-0.39-0.39-1.03-0.39-1.41,0 c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0s0.39-1.03,0-1.41L5.99,4.58z M18.36,16.95 c-0.39-0.39-1.03-0.39-1.41,0c-0.39,0.39-0.39,1.03,0,1.41l1.06,1.06c0.39,0.39,1.03,0.39,1.41,0c0.39-0.39,0.39-1.03,0-1.41 L18.36,16.95z M19.42,5.99c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06c-0.39,0.39-0.39,1.03,0,1.41 s1.03,0.39,1.41,0L19.42,5.99z M7.05,18.36c0.39-0.39,0.39-1.03,0-1.41c-0.39-0.39-1.03-0.39-1.41,0l-1.06,1.06 c-0.39,0.39-0.39,1.03,0,1.41s1.03,0.39,1.41,0L7.05,18.36z"}))}function G(e){return r.createElement("svg",(0,l.Z)({viewBox:"0 0 24 24",width:24,height:24},e),r.createElement("path",{fill:"currentColor",d:"M9.37,5.51C9.19,6.15,9.1,6.82,9.1,7.5c0,4.08,3.32,7.4,7.4,7.4c0.68,0,1.35-0.09,1.99-0.27C17.45,17.19,14.93,19,12,19 c-3.86,0-7-3.14-7-7C5,9.07,6.81,6.55,9.37,5.51z M12,3c-4.97,0-9,4.03-9,9s4.03,9,9,9s9-4.03,9-9c0-0.46-0.04-0.92-0.1-1.36 c-0.98,1.37-2.58,2.26-4.4,2.26c-2.98,0-5.4-2.42-5.4-5.4c0-1.81,0.89-3.42,2.26-4.4C12.92,3.04,12.46,3,12,3L12,3z"}))}const H={toggle:"toggle_vylO",toggleButton:"toggleButton_gllP",darkToggleIcon:"darkToggleIcon_wfgR",lightToggleIcon:"lightToggleIcon_pyhR",toggleButtonDisabled:"toggleButtonDisabled_aARS"};function Z(e){let{className:t,buttonClassName:n,value:o,onChange:i}=e;const l=(0,$.Z)(),s=(0,c.I)({message:"Switch between dark and light mode (currently {mode})",id:"theme.colorToggle.ariaLabel",description:"The ARIA label for the navbar color mode toggle"},{mode:"dark"===o?(0,c.I)({message:"dark mode",id:"theme.colorToggle.ariaLabel.mode.dark",description:"The name for the dark color mode"}):(0,c.I)({message:"light mode",id:"theme.colorToggle.ariaLabel.mode.light",description:"The name for the light color mode"})});return r.createElement("div",{className:(0,a.Z)(H.toggle,t)},r.createElement("button",{className:(0,a.Z)("clean-btn",H.toggleButton,!l&&H.toggleButtonDisabled,n),type:"button",onClick:()=>i("dark"===o?"light":"dark"),disabled:!l,title:s,"aria-label":s,"aria-live":"polite"},r.createElement(q,{className:(0,a.Z)(H.toggleIcon,H.lightToggleIcon)}),r.createElement(G,{className:(0,a.Z)(H.toggleIcon,H.darkToggleIcon)})))}const V=r.memo(Z),W="darkNavbarColorModeToggle_X3D1";function Q(e){let{className:t}=e;const n=(0,w.L)().navbar.style,a=(0,w.L)().colorMode.disableSwitch,{colorMode:o,setColorMode:i}=(0,z.I)();return a?null:r.createElement(V,{className:t,buttonClassName:"dark"===n?W:void 0,value:o,onChange:i})}var K=n(1327);function Y(){return r.createElement(K.Z,{className:"navbar__brand",imageClassName:"navbar__logo",titleClassName:"navbar__title text--truncate"})}function X(){const e=(0,I.e)();return r.createElement("button",{type:"button","aria-label":(0,c.I)({id:"theme.docs.sidebar.closeSidebarButtonAriaLabel",message:"Close navigation bar",description:"The ARIA label for close button of mobile sidebar"}),className:"clean-btn navbar-sidebar__close",onClick:()=>e.toggle()},r.createElement(E,{color:"var(--ifm-color-emphasis-600)"}))}function J(){return r.createElement("div",{className:"navbar-sidebar__brand"},r.createElement(Y,null),r.createElement(Q,{className:"margin-right--md"}),r.createElement(X,null))}var ee=n(9960),te=n(4996),ne=n(3919),re=n(8022),ae=n(9471);function oe(e){let{activeBasePath:t,activeBaseRegex:n,to:a,href:o,label:i,html:s,isDropdownLink:c,prependBaseUrlToHref:u,...d}=e;const p=(0,te.Z)(a),f=(0,te.Z)(t),m=(0,te.Z)(o,{forcePrependBaseUrl:!0}),h=i&&o&&!(0,ne.Z)(o),g=s?{dangerouslySetInnerHTML:{__html:s}}:{children:r.createElement(r.Fragment,null,i,h&&r.createElement(ae.Z,c&&{width:12,height:12}))};return o?r.createElement(ee.Z,(0,l.Z)({href:u?m:o},d,g)):r.createElement(ee.Z,(0,l.Z)({to:p,isNavLink:!0},(t||n)&&{isActive:(e,t)=>n?(0,re.F)(n,t.pathname):t.pathname.startsWith(f)},d,g))}function ie(e){let{className:t,isDropdownItem:n=!1,...o}=e;const i=r.createElement(oe,(0,l.Z)({className:(0,a.Z)(n?"dropdown__link":"navbar__item navbar__link",t),isDropdownLink:n},o));return n?r.createElement("li",null,i):i}function le(e){let{className:t,isDropdownItem:n,...o}=e;return r.createElement("li",{className:"menu__list-item"},r.createElement(oe,(0,l.Z)({className:(0,a.Z)("menu__link",t)},o)))}function se(e){let{mobile:t=!1,position:n,...a}=e;const o=t?le:ie;return r.createElement(o,(0,l.Z)({},a,{activeClassName:a.activeClassName??(t?"menu__link--active":"navbar__link--active")}))}var ce=n(6043),ue=n(8596),de=n(2263);function pe(e,t){return e.some((e=>function(e,t){return!!(0,ue.Mg)(e.to,t)||!!(0,re.F)(e.activeBaseRegex,t)||!(!e.activeBasePath||!t.startsWith(e.activeBasePath))}(e,t)))}function fe(e){let{items:t,position:n,className:o,onClick:i,...s}=e;const c=(0,r.useRef)(null),[u,d]=(0,r.useState)(!1);return(0,r.useEffect)((()=>{const e=e=>{c.current&&!c.current.contains(e.target)&&d(!1)};return document.addEventListener("mousedown",e),document.addEventListener("touchstart",e),document.addEventListener("focusin",e),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("touchstart",e),document.removeEventListener("focusin",e)}}),[c]),r.createElement("div",{ref:c,className:(0,a.Z)("navbar__item","dropdown","dropdown--hoverable",{"dropdown--right":"right"===n,"dropdown--show":u})},r.createElement(oe,(0,l.Z)({"aria-haspopup":"true","aria-expanded":u,role:"button",href:s.to?void 0:"#",className:(0,a.Z)("navbar__link",o)},s,{onClick:s.to?void 0:e=>e.preventDefault(),onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),d(!u))}}),s.children??s.label),r.createElement("ul",{className:"dropdown__menu"},t.map(((e,t)=>r.createElement(Ze,(0,l.Z)({isDropdownItem:!0,activeClassName:"dropdown__link--active"},e,{key:t}))))))}function me(e){let{items:t,className:n,position:o,onClick:i,...c}=e;const u=function(){const{siteConfig:{baseUrl:e}}=(0,de.Z)(),{pathname:t}=(0,s.TH)();return t.replace(e,"/")}(),d=pe(t,u),{collapsed:p,toggleCollapsed:f,setCollapsed:m}=(0,ce.u)({initialState:()=>!d});return(0,r.useEffect)((()=>{d&&m(!d)}),[u,d,m]),r.createElement("li",{className:(0,a.Z)("menu__list-item",{"menu__list-item--collapsed":p})},r.createElement(oe,(0,l.Z)({role:"button",className:(0,a.Z)("menu__link menu__link--sublist menu__link--sublist-caret",n)},c,{onClick:e=>{e.preventDefault(),f()}}),c.children??c.label),r.createElement(ce.z,{lazy:!0,as:"ul",className:"menu__list",collapsed:p},t.map(((e,t)=>r.createElement(Ze,(0,l.Z)({mobile:!0,isDropdownItem:!0,onClick:i,activeClassName:"menu__link--active"},e,{key:t}))))))}function he(e){let{mobile:t=!1,...n}=e;const a=t?me:fe;return r.createElement(a,n)}var ge=n(4711);function be(e){let{width:t=20,height:n=20,...a}=e;return r.createElement("svg",(0,l.Z)({viewBox:"0 0 24 24",width:t,height:n,"aria-hidden":!0},a),r.createElement("path",{fill:"currentColor",d:"M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"}))}const ve="iconLanguage_nlXk";function ye(){return r.createElement("svg",{width:"15",height:"15",className:"DocSearch-Control-Key-Icon"},r.createElement("path",{d:"M4.505 4.496h2M5.505 5.496v5M8.216 4.496l.055 5.993M10 7.5c.333.333.5.667.5 1v2M12.326 4.5v5.996M8.384 4.496c1.674 0 2.116 0 2.116 1.5s-.442 1.5-2.116 1.5M3.205 9.303c-.09.448-.277 1.21-1.241 1.203C1 10.5.5 9.513.5 8V7c0-1.57.5-2.5 1.464-2.494.964.006 1.134.598 1.24 1.342M12.553 10.5h1.953",strokeWidth:"1.2",stroke:"currentColor",fill:"none",strokeLinecap:"square"}))}var we=n(830),ke=["translations"];function Ee(){return Ee=Object.assign||function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,r=new Array(t);n=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var Ce="Ctrl";var _e=r.forwardRef((function(e,t){var n=e.translations,a=void 0===n?{}:n,o=Te(e,ke),i=a.buttonText,l=void 0===i?"Search":i,s=a.buttonAriaLabel,c=void 0===s?"Search":s,u=Se((0,r.useState)(null),2),d=u[0],p=u[1];return(0,r.useEffect)((function(){"undefined"!=typeof navigator&&(/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform)?p("\u2318"):p(Ce))}),[]),r.createElement("button",Ee({type:"button",className:"DocSearch DocSearch-Button","aria-label":c},o,{ref:t}),r.createElement("span",{className:"DocSearch-Button-Container"},r.createElement(we.W,null),r.createElement("span",{className:"DocSearch-Button-Placeholder"},l)),r.createElement("span",{className:"DocSearch-Button-Keys"},null!==d&&r.createElement(r.Fragment,null,r.createElement("kbd",{className:"DocSearch-Button-Key"},d===Ce?r.createElement(ye,null):d),r.createElement("kbd",{className:"DocSearch-Button-Key"},"K"))))})),Ae=n(5742),Oe=n(6177),Re=n(239),Le=n(3320);var Ie=n(3935);const Pe={button:{buttonText:(0,c.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"}),buttonAriaLabel:(0,c.I)({id:"theme.SearchBar.label",message:"Search",description:"The ARIA label and placeholder for search button"})},modal:{searchBox:{resetButtonTitle:(0,c.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),resetButtonAriaLabel:(0,c.I)({id:"theme.SearchModal.searchBox.resetButtonTitle",message:"Clear the query",description:"The label and ARIA label for search box reset button"}),cancelButtonText:(0,c.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"}),cancelButtonAriaLabel:(0,c.I)({id:"theme.SearchModal.searchBox.cancelButtonText",message:"Cancel",description:"The label and ARIA label for search box cancel button"})},startScreen:{recentSearchesTitle:(0,c.I)({id:"theme.SearchModal.startScreen.recentSearchesTitle",message:"Recent",description:"The title for recent searches"}),noRecentSearchesText:(0,c.I)({id:"theme.SearchModal.startScreen.noRecentSearchesText",message:"No recent searches",description:"The text when no recent searches"}),saveRecentSearchButtonTitle:(0,c.I)({id:"theme.SearchModal.startScreen.saveRecentSearchButtonTitle",message:"Save this search",description:"The label for save recent search button"}),removeRecentSearchButtonTitle:(0,c.I)({id:"theme.SearchModal.startScreen.removeRecentSearchButtonTitle",message:"Remove this search from history",description:"The label for remove recent search button"}),favoriteSearchesTitle:(0,c.I)({id:"theme.SearchModal.startScreen.favoriteSearchesTitle",message:"Favorite",description:"The title for favorite searches"}),removeFavoriteSearchButtonTitle:(0,c.I)({id:"theme.SearchModal.startScreen.removeFavoriteSearchButtonTitle",message:"Remove this search from favorites",description:"The label for remove favorite search button"})},errorScreen:{titleText:(0,c.I)({id:"theme.SearchModal.errorScreen.titleText",message:"Unable to fetch results",description:"The title for error screen of search modal"}),helpText:(0,c.I)({id:"theme.SearchModal.errorScreen.helpText",message:"You might want to check your network connection.",description:"The help text for error screen of search modal"})},footer:{selectText:(0,c.I)({id:"theme.SearchModal.footer.selectText",message:"to select",description:"The explanatory text of the action for the enter key"}),selectKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.selectKeyAriaLabel",message:"Enter key",description:"The ARIA label for the Enter key button that makes the selection"}),navigateText:(0,c.I)({id:"theme.SearchModal.footer.navigateText",message:"to navigate",description:"The explanatory text of the action for the Arrow up and Arrow down key"}),navigateUpKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.navigateUpKeyAriaLabel",message:"Arrow up",description:"The ARIA label for the Arrow up key button that makes the navigation"}),navigateDownKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.navigateDownKeyAriaLabel",message:"Arrow down",description:"The ARIA label for the Arrow down key button that makes the navigation"}),closeText:(0,c.I)({id:"theme.SearchModal.footer.closeText",message:"to close",description:"The explanatory text of the action for Escape key"}),closeKeyAriaLabel:(0,c.I)({id:"theme.SearchModal.footer.closeKeyAriaLabel",message:"Escape key",description:"The ARIA label for the Escape key button that close the modal"}),searchByText:(0,c.I)({id:"theme.SearchModal.footer.searchByText",message:"Search by",description:"The text explain that the search is making by Algolia"})},noResultsScreen:{noResultsText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.noResultsText",message:"No results for",description:"The text explains that there are no results for the following search"}),suggestedQueryText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.suggestedQueryText",message:"Try searching for",description:"The text for the suggested query when no results are found for the following search"}),reportMissingResultsText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsText",message:"Believe this query should return results?",description:"The text for the question where the user thinks there are missing results"}),reportMissingResultsLinkText:(0,c.I)({id:"theme.SearchModal.noResultsScreen.reportMissingResultsLinkText",message:"Let us know.",description:"The text for the link to report missing results"})}},placeholder:(0,c.I)({id:"theme.SearchModal.placeholder",message:"Search docs",description:"The placeholder of the input of the DocSearch pop-up modal"})};let Ne=null;function De(e){let{hit:t,children:n}=e;return r.createElement(ee.Z,{to:t.url},n)}function Me(e){let{state:t,onClose:n}=e;const a=(0,Oe.M)();return r.createElement(ee.Z,{to:a(t.query),onClick:n},r.createElement(c.Z,{id:"theme.SearchBar.seeAll",values:{count:t.context.nbHits}},"See all {count} results"))}function Fe(e){var t;let{contextualSearch:a,externalUrlRegex:o,...i}=e;const{siteMetadata:c}=(0,de.Z)(),u=(0,Re.l)(),d=function(){const{locale:e,tags:t}=(0,Le._q)();return[`language:${e}`,t.map((e=>`docusaurus_tag:${e}`))]}(),p=(null==(t=i.searchParameters)?void 0:t.facetFilters)??[],f=a?function(e,t){const n=e=>"string"==typeof e?[e]:e;return[...n(e),...n(t)]}(d,p):p,m={...i.searchParameters,facetFilters:f},h=(0,s.k6)(),g=(0,r.useRef)(null),b=(0,r.useRef)(null),[v,y]=(0,r.useState)(!1),[w,k]=(0,r.useState)(void 0),E=(0,r.useCallback)((()=>Ne?Promise.resolve():Promise.all([n.e(6780).then(n.bind(n,6780)),Promise.all([n.e(532),n.e(6945)]).then(n.bind(n,6945)),Promise.all([n.e(532),n.e(8894)]).then(n.bind(n,8894))]).then((e=>{let[{DocSearchModal:t}]=e;Ne=t}))),[]),S=(0,r.useCallback)((()=>{E().then((()=>{g.current=document.createElement("div"),document.body.insertBefore(g.current,document.body.firstChild),y(!0)}))}),[E,y]),x=(0,r.useCallback)((()=>{var e;y(!1),null==(e=g.current)||e.remove()}),[y]),T=(0,r.useCallback)((e=>{E().then((()=>{y(!0),k(e.key)}))}),[E,y,k]),C=(0,r.useRef)({navigate(e){let{itemUrl:t}=e;(0,re.F)(o,t)?window.location.href=t:h.push(t)}}).current,_=(0,r.useRef)((e=>i.transformItems?i.transformItems(e):e.map((e=>({...e,url:u(e.url)}))))).current,A=(0,r.useMemo)((()=>e=>r.createElement(Me,(0,l.Z)({},e,{onClose:x}))),[x]),O=(0,r.useCallback)((e=>(e.addAlgoliaAgent("docusaurus",c.docusaurusVersion),e)),[c.docusaurusVersion]);return function(e){var t=e.isOpen,n=e.onOpen,a=e.onClose,o=e.onInput,i=e.searchButtonRef;r.useEffect((function(){function e(e){(27===e.keyCode&&t||"k"===e.key.toLowerCase()&&(e.metaKey||e.ctrlKey)||!function(e){var t=e.target,n=t.tagName;return t.isContentEditable||"INPUT"===n||"SELECT"===n||"TEXTAREA"===n}(e)&&"/"===e.key&&!t)&&(e.preventDefault(),t?a():document.body.classList.contains("DocSearch--active")||document.body.classList.contains("DocSearch--active")||n()),i&&i.current===document.activeElement&&o&&/[a-zA-Z0-9]/.test(String.fromCharCode(e.keyCode))&&o(e)}return window.addEventListener("keydown",e),function(){window.removeEventListener("keydown",e)}}),[t,n,a,o,i])}({isOpen:v,onOpen:S,onClose:x,onInput:T,searchButtonRef:b}),r.createElement(r.Fragment,null,r.createElement(Ae.Z,null,r.createElement("link",{rel:"preconnect",href:`https://${i.appId}-dsn.algolia.net`,crossOrigin:"anonymous"})),r.createElement(_e,{onTouchStart:E,onFocus:E,onMouseOver:E,onClick:S,ref:b,translations:Pe.button}),v&&Ne&&g.current&&(0,Ie.createPortal)(r.createElement(Ne,(0,l.Z)({onClose:x,initialScrollY:window.scrollY,initialQuery:w,navigator:C,transformItems:_,hitComponent:De,transformSearchClient:O},i.searchPagePath&&{resultsFooterComponent:A},i,{searchParameters:m,placeholder:Pe.placeholder,translations:Pe.modal})),g.current))}function Be(){const{siteConfig:e}=(0,de.Z)();return r.createElement(Fe,e.themeConfig.algolia)}const je="searchBox_ZlJk";function Ue(e){let{children:t,className:n}=e;return r.createElement("div",{className:(0,a.Z)(n,je)},t)}var ze=n(143),$e=n(2802);var qe=n(373);const Ge=e=>e.docs.find((t=>t.id===e.mainDocId));const He={default:se,localeDropdown:function(e){let{mobile:t,dropdownItemsBefore:n,dropdownItemsAfter:a,...o}=e;const{i18n:{currentLocale:i,locales:u,localeConfigs:d}}=(0,de.Z)(),p=(0,ge.l)(),{search:f,hash:m}=(0,s.TH)(),h=[...n,...u.map((e=>{const n=`${`pathname://${p.createUrl({locale:e,fullyQualified:!1})}`}${f}${m}`;return{label:d[e].label,lang:d[e].htmlLang,to:n,target:"_self",autoAddBaseUrl:!1,className:e===i?t?"menu__link--active":"dropdown__link--active":""}})),...a],g=t?(0,c.I)({message:"Languages",id:"theme.navbar.mobileLanguageDropdown.label",description:"The label for the mobile language switcher dropdown"}):d[i].label;return r.createElement(he,(0,l.Z)({},o,{mobile:t,label:r.createElement(r.Fragment,null,r.createElement(be,{className:ve}),g),items:h}))},search:function(e){let{mobile:t,className:n}=e;return t?null:r.createElement(Ue,{className:n},r.createElement(Be,null))},dropdown:he,html:function(e){let{value:t,className:n,mobile:o=!1,isDropdownItem:i=!1}=e;const l=i?"li":"div";return r.createElement(l,{className:(0,a.Z)({navbar__item:!o&&!i,"menu__list-item":o},n),dangerouslySetInnerHTML:{__html:t}})},doc:function(e){let{docId:t,label:n,docsPluginId:a,...o}=e;const{activeDoc:i}=(0,ze.Iw)(a),s=(0,$e.vY)(t,a);return null===s?null:r.createElement(se,(0,l.Z)({exact:!0},o,{isActive:()=>(null==i?void 0:i.path)===s.path||!(null==i||!i.sidebar)&&i.sidebar===s.sidebar,label:n??s.id,to:s.path}))},docSidebar:function(e){let{sidebarId:t,label:n,docsPluginId:a,...o}=e;const{activeDoc:i}=(0,ze.Iw)(a),s=(0,$e.oz)(t,a).link;if(!s)throw new Error(`DocSidebarNavbarItem: Sidebar with ID "${t}" doesn't have anything to be linked to.`);return r.createElement(se,(0,l.Z)({exact:!0},o,{isActive:()=>(null==i?void 0:i.sidebar)===t,label:n??s.label,to:s.path}))},docsVersion:function(e){let{label:t,to:n,docsPluginId:a,...o}=e;const i=(0,$e.lO)(a)[0],s=t??i.label,c=n??(e=>e.docs.find((t=>t.id===e.mainDocId)))(i).path;return r.createElement(se,(0,l.Z)({},o,{label:s,to:c}))},docsVersionDropdown:function(e){let{mobile:t,docsPluginId:n,dropdownActiveClassDisabled:a,dropdownItemsBefore:o,dropdownItemsAfter:i,...u}=e;const{search:d,hash:p}=(0,s.TH)(),f=(0,ze.Iw)(n),m=(0,ze.gB)(n),{savePreferredVersionName:h}=(0,qe.J)(n),g=[...o,...m.map((e=>{const t=f.alternateDocVersions[e.name]??Ge(e);return{label:e.label,to:`${t.path}${d}${p}`,isActive:()=>e===f.activeVersion,onClick:()=>h(e.name)}})),...i],b=(0,$e.lO)(n)[0],v=t&&g.length>1?(0,c.I)({id:"theme.navbar.mobileVersionsDropdown.label",message:"Versions",description:"The label for the navbar versions dropdown on mobile view"}):b.label,y=t&&g.length>1?void 0:Ge(b).path;return g.length<=1?r.createElement(se,(0,l.Z)({},u,{mobile:t,label:v,to:y,isActive:a?()=>!1:void 0})):r.createElement(he,(0,l.Z)({},u,{mobile:t,label:v,to:y,items:g,isActive:a?()=>!1:void 0}))}};function Ze(e){let{type:t,...n}=e;const a=function(e,t){return e&&"default"!==e?e:"items"in t?"dropdown":"default"}(t,n),o=He[a];if(!o)throw new Error(`No NavbarItem component found for type "${t}".`);return r.createElement(o,n)}function Ve(){const e=(0,I.e)(),t=(0,w.L)().navbar.items;return r.createElement("ul",{className:"menu__list"},t.map(((t,n)=>r.createElement(Ze,(0,l.Z)({mobile:!0},t,{onClick:()=>e.toggle(),key:n})))))}function We(e){return r.createElement("button",(0,l.Z)({},e,{type:"button",className:"clean-btn navbar-sidebar__back"}),r.createElement(c.Z,{id:"theme.navbar.mobileSidebarSecondaryMenu.backButtonLabel",description:"The label of the back button to return to main menu, inside the mobile navbar sidebar secondary menu (notably used to display the docs sidebar)"},"\u2190 Back to main menu"))}function Qe(){const e=0===(0,w.L)().navbar.items.length,t=j();return r.createElement(r.Fragment,null,!e&&r.createElement(We,{onClick:()=>t.hide()}),t.content)}function Ke(){const e=(0,I.e)();var t;return void 0===(t=e.shown)&&(t=!0),(0,r.useEffect)((()=>(document.body.style.overflow=t?"hidden":"visible",()=>{document.body.style.overflow="visible"})),[t]),e.shouldRender?r.createElement(U,{header:r.createElement(J,null),primaryMenu:r.createElement(Ve,null),secondaryMenu:r.createElement(Qe,null)}):null}const Ye="navbarHideable_m1mJ",Xe="navbarHidden_jGov";function Je(e){return r.createElement("div",(0,l.Z)({role:"presentation"},e,{className:(0,a.Z)("navbar-sidebar__backdrop",e.className)}))}function et(e){let{children:t}=e;const{navbar:{hideOnScroll:n,style:o}}=(0,w.L)(),i=(0,I.e)(),{navbarRef:l,isNavbarVisible:s}=function(e){const[t,n]=(0,r.useState)(e),a=(0,r.useRef)(!1),o=(0,r.useRef)(0),i=(0,r.useCallback)((e=>{null!==e&&(o.current=e.getBoundingClientRect().height)}),[]);return(0,P.RF)(((t,r)=>{let{scrollY:i}=t;if(!e)return;if(i=l?n(!1):i+c{if(!e)return;const r=t.location.hash;if(r?document.getElementById(r.substring(1)):void 0)return a.current=!0,void n(!1);n(!0)})),{navbarRef:i,isNavbarVisible:t}}(n);return r.createElement("nav",{ref:l,"aria-label":(0,c.I)({id:"theme.NavBar.navAriaLabel",message:"Main",description:"The ARIA label for the main navigation"}),className:(0,a.Z)("navbar","navbar--fixed-top",n&&[Ye,!s&&Xe],{"navbar--dark":"dark"===o,"navbar--primary":"primary"===o,"navbar-sidebar--show":i.shown})},t,r.createElement(Je,{onClick:i.toggle}),r.createElement(Ke,null))}var tt=n(8780);const nt="errorBoundaryError_a6uf";function rt(e){return r.createElement("button",(0,l.Z)({type:"button"},e),r.createElement(c.Z,{id:"theme.ErrorPageContent.tryAgain",description:"The label of the button to try again rendering when the React error boundary captures an error"},"Try again"))}function at(e){let{error:t}=e;const n=(0,tt.getErrorCausalChain)(t).map((e=>e.message)).join("\n\nCause:\n");return r.createElement("p",{className:nt},n)}class ot extends r.Component{componentDidCatch(e,t){throw this.props.onError(e,t)}render(){return this.props.children}}function it(e){let{width:t=30,height:n=30,className:a,...o}=e;return r.createElement("svg",(0,l.Z)({className:a,width:t,height:n,viewBox:"0 0 30 30","aria-hidden":"true"},o),r.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"2",d:"M4 7h22M4 15h22M4 23h22"}))}function lt(){const{toggle:e,shown:t}=(0,I.e)();return r.createElement("button",{onClick:e,"aria-label":(0,c.I)({id:"theme.docs.sidebar.toggleSidebarButtonAriaLabel",message:"Toggle navigation bar",description:"The ARIA label for hamburger menu button of mobile navigation"}),"aria-expanded":t,className:"navbar__toggle clean-btn",type:"button"},r.createElement(it,null))}const st="colorModeToggle_DEke";function ct(e){let{items:t}=e;return r.createElement(r.Fragment,null,t.map(((e,t)=>r.createElement(ot,{key:t,onError:t=>new Error(`A theme navbar item failed to render.\nPlease double-check the following navbar item (themeConfig.navbar.items) of your Docusaurus config:\n${JSON.stringify(e,null,2)}`,{cause:t})},r.createElement(Ze,e)))))}function ut(e){let{left:t,right:n}=e;return r.createElement("div",{className:"navbar__inner"},r.createElement("div",{className:"navbar__items"},t),r.createElement("div",{className:"navbar__items navbar__items--right"},n))}function dt(){const e=(0,I.e)(),t=(0,w.L)().navbar.items,[n,a]=function(e){function t(e){return"left"===(e.position??"right")}return[e.filter(t),e.filter((e=>!t(e)))]}(t),o=t.find((e=>"search"===e.type));return r.createElement(ut,{left:r.createElement(r.Fragment,null,!e.disabled&&r.createElement(lt,null),r.createElement(Y,null),r.createElement(ct,{items:n})),right:r.createElement(r.Fragment,null,r.createElement(ct,{items:a}),r.createElement(Q,{className:st}),!o&&r.createElement(Ue,null,r.createElement(Be,null)))})}function pt(){return r.createElement(et,null,r.createElement(dt,null))}function ft(e){let{item:t}=e;const{to:n,href:a,label:o,prependBaseUrlToHref:i,...s}=t,c=(0,te.Z)(n),u=(0,te.Z)(a,{forcePrependBaseUrl:!0});return r.createElement(ee.Z,(0,l.Z)({className:"footer__link-item"},a?{href:i?u:a}:{to:c},s),o,a&&!(0,ne.Z)(a)&&r.createElement(ae.Z,null))}function mt(e){let{item:t}=e;return t.html?r.createElement("li",{className:"footer__item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement("li",{key:t.href??t.to,className:"footer__item"},r.createElement(ft,{item:t}))}function ht(e){let{column:t}=e;return r.createElement("div",{className:"col footer__col"},r.createElement("div",{className:"footer__title"},t.title),r.createElement("ul",{className:"footer__items clean-list"},t.items.map(((e,t)=>r.createElement(mt,{key:t,item:e})))))}function gt(e){let{columns:t}=e;return r.createElement("div",{className:"row footer__links"},t.map(((e,t)=>r.createElement(ht,{key:t,column:e}))))}function bt(){return r.createElement("span",{className:"footer__link-separator"},"\xb7")}function vt(e){let{item:t}=e;return t.html?r.createElement("span",{className:"footer__link-item",dangerouslySetInnerHTML:{__html:t.html}}):r.createElement(ft,{item:t})}function yt(e){let{links:t}=e;return r.createElement("div",{className:"footer__links text--center"},r.createElement("div",{className:"footer__links"},t.map(((e,n)=>r.createElement(r.Fragment,{key:n},r.createElement(vt,{item:e}),t.length!==n+1&&r.createElement(bt,null))))))}function wt(e){let{links:t}=e;return function(e){return"title"in e[0]}(t)?r.createElement(gt,{columns:t}):r.createElement(yt,{links:t})}var kt=n(941);const Et="footerLogoLink_BH7S";function St(e){let{logo:t}=e;const{withBaseUrl:n}=(0,te.C)(),o={light:n(t.src),dark:n(t.srcDark??t.src)};return r.createElement(kt.Z,{className:(0,a.Z)("footer__logo",t.className),alt:t.alt,sources:o,width:t.width,height:t.height,style:t.style})}function xt(e){let{logo:t}=e;return t.href?r.createElement(ee.Z,{href:t.href,className:Et,target:t.target},r.createElement(St,{logo:t})):r.createElement(St,{logo:t})}function Tt(e){let{copyright:t}=e;return r.createElement("div",{className:"footer__copyright",dangerouslySetInnerHTML:{__html:t}})}function Ct(e){let{style:t,links:n,logo:o,copyright:i}=e;return r.createElement("footer",{className:(0,a.Z)("footer",{"footer--dark":"dark"===t})},r.createElement("div",{className:"container container-fluid"},n,(o||i)&&r.createElement("div",{className:"footer__bottom text--center"},o&&r.createElement("div",{className:"margin-bottom--sm"},o),i)))}function _t(){const{footer:e}=(0,w.L)();if(!e)return null;const{copyright:t,links:n,logo:a,style:o}=e;return r.createElement(Ct,{style:o,links:n&&n.length>0&&r.createElement(wt,{links:n}),logo:a&&r.createElement(xt,{logo:a}),copyright:t&&r.createElement(Tt,{copyright:t})})}const At=r.memo(_t),Ot=(0,N.Qc)([z.S,k.pl,P.OC,qe.L5,i.VC,function(e){let{children:t}=e;return r.createElement(D.n2,null,r.createElement(I.M,null,r.createElement(F,null,t)))}]);function Rt(e){let{children:t}=e;return r.createElement(Ot,null,t)}function Lt(e){let{error:t,tryAgain:n}=e;return r.createElement("main",{className:"container margin-vert--xl"},r.createElement("div",{className:"row"},r.createElement("div",{className:"col col--6 col--offset-3"},r.createElement("h1",{className:"hero__title"},r.createElement(c.Z,{id:"theme.ErrorPageContent.title",description:"The title of the fallback page when the page crashed"},"This page crashed.")),r.createElement("div",{className:"margin-vert--lg"},r.createElement(rt,{onClick:n,className:"button button--primary shadow--lw"})),r.createElement("hr",null),r.createElement("div",{className:"margin-vert--md"},r.createElement(at,{error:t})))))}const It="mainWrapper_z2l0";function Pt(e){const{children:t,noFooter:n,wrapperClassName:l,title:s,description:c}=e;return(0,b.t)(),r.createElement(Rt,null,r.createElement(i.d,{title:s,description:c}),r.createElement(y,null),r.createElement(L,null),r.createElement(pt,null),r.createElement("div",{id:d,className:(0,a.Z)(g.k.wrapper.main,It,l)},r.createElement(o.Z,{fallback:e=>r.createElement(Lt,e)},t)),!n&&r.createElement(At,null))}},1327:(e,t,n)=>{"use strict";n.d(t,{Z:()=>d});var r=n(7462),a=n(7294),o=n(9960),i=n(4996),l=n(2263),s=n(6668),c=n(941);function u(e){let{logo:t,alt:n,imageClassName:r}=e;const o={light:(0,i.Z)(t.src),dark:(0,i.Z)(t.srcDark||t.src)},l=a.createElement(c.Z,{className:t.className,sources:o,height:t.height,width:t.width,alt:n,style:t.style});return r?a.createElement("div",{className:r},l):l}function d(e){const{siteConfig:{title:t}}=(0,l.Z)(),{navbar:{title:n,logo:c}}=(0,s.L)(),{imageClassName:d,titleClassName:p,...f}=e,m=(0,i.Z)((null==c?void 0:c.href)||"/"),h=n?"":t,g=(null==c?void 0:c.alt)??h;return a.createElement(o.Z,(0,r.Z)({to:m},f,(null==c?void 0:c.target)&&{target:c.target}),c&&a.createElement(u,{logo:c,alt:g,imageClassName:d}),null!=n&&a.createElement("b",{className:p},n))}},197:(e,t,n)=>{"use strict";n.d(t,{Z:()=>o});var r=n(7294),a=n(5742);function o(e){let{locale:t,version:n,tag:o}=e;const i=t;return r.createElement(a.Z,null,t&&r.createElement("meta",{name:"docusaurus_locale",content:t}),n&&r.createElement("meta",{name:"docusaurus_version",content:n}),o&&r.createElement("meta",{name:"docusaurus_tag",content:o}),i&&r.createElement("meta",{name:"docsearch:language",content:i}),n&&r.createElement("meta",{name:"docsearch:version",content:n}),o&&r.createElement("meta",{name:"docsearch:docusaurus_tag",content:o}))}},941:(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});var r=n(7462),a=n(7294),o=n(6010),i=n(2389),l=n(2949);const s={themedImage:"themedImage_ToTc","themedImage--light":"themedImage--light_HNdA","themedImage--dark":"themedImage--dark_i4oU"};function c(e){const t=(0,i.Z)(),{colorMode:n}=(0,l.I)(),{sources:c,className:u,alt:d,...p}=e,f=t?"dark"===n?["dark"]:["light"]:["light","dark"];return a.createElement(a.Fragment,null,f.map((e=>a.createElement("img",(0,r.Z)({key:e,src:c[e],alt:d,className:(0,o.Z)(s.themedImage,s[`themedImage--${e}`],u)},p)))))}},6043:(e,t,n)=>{"use strict";n.d(t,{u:()=>l,z:()=>h});var r=n(7462),a=n(7294),o=n(412),i=n(1442);function l(e){let{initialState:t}=e;const[n,r]=(0,a.useState)(t??!1),o=(0,a.useCallback)((()=>{r((e=>!e))}),[]);return{collapsed:n,setCollapsed:r,toggleCollapsed:o}}const s={display:"none",overflow:"hidden",height:"0px"},c={display:"block",overflow:"visible",height:"auto"};function u(e,t){const n=t?s:c;e.style.display=n.display,e.style.overflow=n.overflow,e.style.height=n.height}function d(e){let{collapsibleRef:t,collapsed:n,animation:r}=e;const o=(0,a.useRef)(!1);(0,a.useEffect)((()=>{const e=t.current;function a(){const t=e.scrollHeight,n=(null==r?void 0:r.duration)??function(e){if((0,i.n)())return 1;const t=e/36;return Math.round(10*(4+15*t**.25+t/5))}(t);return{transition:`height ${n}ms ${(null==r?void 0:r.easing)??"ease-in-out"}`,height:`${t}px`}}function l(){const t=a();e.style.transition=t.transition,e.style.height=t.height}if(!o.current)return u(e,n),void(o.current=!0);return e.style.willChange="height",function(){const t=requestAnimationFrame((()=>{n?(l(),requestAnimationFrame((()=>{e.style.height=s.height,e.style.overflow=s.overflow}))):(e.style.display="block",requestAnimationFrame((()=>{l()})))}));return()=>cancelAnimationFrame(t)}()}),[t,n,r])}function p(e){if(!o.Z.canUseDOM)return e?s:c}function f(e){let{as:t="div",collapsed:n,children:r,animation:o,onCollapseTransitionEnd:i,className:l,disableSSRStyle:s}=e;const c=(0,a.useRef)(null);return d({collapsibleRef:c,collapsed:n,animation:o}),a.createElement(t,{ref:c,style:s?void 0:p(n),onTransitionEnd:e=>{"height"===e.propertyName&&(u(c.current,n),null==i||i(n))},className:l},r)}function m(e){let{collapsed:t,...n}=e;const[o,i]=(0,a.useState)(!t),[l,s]=(0,a.useState)(t);return(0,a.useLayoutEffect)((()=>{t||i(!0)}),[t]),(0,a.useLayoutEffect)((()=>{o&&s(t)}),[o,t]),o?a.createElement(f,(0,r.Z)({},n,{collapsed:l})):null}function h(e){let{lazy:t,...n}=e;const r=t?m:f;return a.createElement(r,n)}},9689:(e,t,n)=>{"use strict";n.d(t,{nT:()=>m,pl:()=>f});var r=n(7294),a=n(2389),o=n(12),i=n(902),l=n(6668);const s=(0,o.WA)("docusaurus.announcement.dismiss"),c=(0,o.WA)("docusaurus.announcement.id"),u=()=>"true"===s.get(),d=e=>s.set(String(e)),p=r.createContext(null);function f(e){let{children:t}=e;const n=function(){const{announcementBar:e}=(0,l.L)(),t=(0,a.Z)(),[n,o]=(0,r.useState)((()=>!!t&&u()));(0,r.useEffect)((()=>{o(u())}),[]);const i=(0,r.useCallback)((()=>{d(!0),o(!0)}),[]);return(0,r.useEffect)((()=>{if(!e)return;const{id:t}=e;let n=c.get();"annoucement-bar"===n&&(n="announcement-bar");const r=t!==n;c.set(t),r&&d(!1),!r&&u()||o(!1)}),[e]),(0,r.useMemo)((()=>({isActive:!!e&&!n,close:i})),[e,n,i])}();return r.createElement(p.Provider,{value:n},t)}function m(){const e=(0,r.useContext)(p);if(!e)throw new i.i6("AnnouncementBarProvider");return e}},2949:(e,t,n)=>{"use strict";n.d(t,{I:()=>g,S:()=>h});var r=n(7294),a=n(412),o=n(902),i=n(12),l=n(6668);const s=r.createContext(void 0),c="theme",u=(0,i.WA)(c),d="light",p="dark",f=e=>e===p?p:d;function m(){const{colorMode:{defaultMode:e,disableSwitch:t,respectPrefersColorScheme:n}}=(0,l.L)(),[o,i]=(0,r.useState)((e=>a.Z.canUseDOM?f(document.documentElement.getAttribute("data-theme")):f(e))(e));(0,r.useEffect)((()=>{t&&u.del()}),[t]);const s=(0,r.useCallback)((function(t,r){void 0===r&&(r={});const{persist:a=!0}=r;t?(i(t),a&&(e=>{u.set(f(e))})(t)):(i(n?window.matchMedia("(prefers-color-scheme: dark)").matches?p:d:e),u.del())}),[n,e]);(0,r.useEffect)((()=>{document.documentElement.setAttribute("data-theme",f(o))}),[o]),(0,r.useEffect)((()=>{if(t)return;const e=e=>{if(e.key!==c)return;const t=u.get();null!==t&&s(f(t))};return window.addEventListener("storage",e),()=>window.removeEventListener("storage",e)}),[t,s]);const m=(0,r.useRef)(!1);return(0,r.useEffect)((()=>{if(t&&!n)return;const e=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>{window.matchMedia("print").matches||m.current?m.current=window.matchMedia("print").matches:s(null)};return e.addListener(r),()=>e.removeListener(r)}),[s,t,n]),(0,r.useMemo)((()=>({colorMode:o,setColorMode:s,get isDarkTheme(){return o===p},setLightTheme(){s(d)},setDarkTheme(){s(p)}})),[o,s])}function h(e){let{children:t}=e;const n=m();return r.createElement(s.Provider,{value:n},t)}function g(){const e=(0,r.useContext)(s);if(null==e)throw new o.i6("ColorModeProvider","Please see https://docusaurus.io/docs/api/themes/configuration#use-color-mode.");return e}},373:(e,t,n)=>{"use strict";n.d(t,{J:()=>y,L5:()=>b,Oh:()=>w});var r=n(7294),a=n(143),o=n(9935),i=n(6668),l=n(2802),s=n(902),c=n(12);const u=e=>`docs-preferred-version-${e}`,d=(e,t,n)=>{(0,c.WA)(u(e),{persistence:t}).set(n)},p=(e,t)=>(0,c.WA)(u(e),{persistence:t}).get(),f=(e,t)=>{(0,c.WA)(u(e),{persistence:t}).del()};const m=r.createContext(null);function h(){const e=(0,a._r)(),t=(0,i.L)().docs.versionPersistence,n=(0,r.useMemo)((()=>Object.keys(e)),[e]),[o,l]=(0,r.useState)((()=>(e=>Object.fromEntries(e.map((e=>[e,{preferredVersionName:null}]))))(n)));(0,r.useEffect)((()=>{l(function(e){let{pluginIds:t,versionPersistence:n,allDocsData:r}=e;function a(e){const t=p(e,n);return r[e].versions.some((e=>e.name===t))?{preferredVersionName:t}:(f(e,n),{preferredVersionName:null})}return Object.fromEntries(t.map((e=>[e,a(e)])))}({allDocsData:e,versionPersistence:t,pluginIds:n}))}),[e,t,n]);return[o,(0,r.useMemo)((()=>({savePreferredVersion:function(e,n){d(e,t,n),l((t=>({...t,[e]:{preferredVersionName:n}})))}})),[t])]}function g(e){let{children:t}=e;const n=h();return r.createElement(m.Provider,{value:n},t)}function b(e){let{children:t}=e;return l.cE?r.createElement(g,null,t):r.createElement(r.Fragment,null,t)}function v(){const e=(0,r.useContext)(m);if(!e)throw new s.i6("DocsPreferredVersionContextProvider");return e}function y(e){void 0===e&&(e=o.m);const t=(0,a.zh)(e),[n,i]=v(),{preferredVersionName:l}=n[e];return{preferredVersion:t.versions.find((e=>e.name===l))??null,savePreferredVersionName:(0,r.useCallback)((t=>{i.savePreferredVersion(e,t)}),[i,e])}}function w(){const e=(0,a._r)(),[t]=v();function n(n){const r=e[n],{preferredVersionName:a}=t[n];return r.versions.find((e=>e.name===a))??null}const r=Object.keys(e);return Object.fromEntries(r.map((e=>[e,n(e)])))}},1116:(e,t,n)=>{"use strict";n.d(t,{V:()=>s,b:()=>l});var r=n(7294),a=n(902);const o=Symbol("EmptyContext"),i=r.createContext(o);function l(e){let{children:t,name:n,items:a}=e;const o=(0,r.useMemo)((()=>n&&a?{name:n,items:a}:null),[n,a]);return r.createElement(i.Provider,{value:o},t)}function s(){const e=(0,r.useContext)(i);if(e===o)throw new a.i6("DocsSidebarProvider");return e}},3163:(e,t,n)=>{"use strict";n.d(t,{M:()=>d,e:()=>p});var r=n(7294),a=n(3102),o=n(7524),i=n(1980),l=n(6668),s=n(902);const c=r.createContext(void 0);function u(){const e=function(){const e=(0,a.HY)(),{items:t}=(0,l.L)().navbar;return 0===t.length&&!e.component}(),t=(0,o.i)(),n=!e&&"mobile"===t,[s,c]=(0,r.useState)(!1);(0,i.Rb)((()=>{if(s)return c(!1),!1}));const u=(0,r.useCallback)((()=>{c((e=>!e))}),[]);return(0,r.useEffect)((()=>{"desktop"===t&&c(!1)}),[t]),(0,r.useMemo)((()=>({disabled:e,shouldRender:n,toggle:u,shown:s})),[e,n,u,s])}function d(e){let{children:t}=e;const n=u();return r.createElement(c.Provider,{value:n},t)}function p(){const e=r.useContext(c);if(void 0===e)throw new s.i6("NavbarMobileSidebarProvider");return e}},3102:(e,t,n)=>{"use strict";n.d(t,{HY:()=>l,Zo:()=>s,n2:()=>i});var r=n(7294),a=n(902);const o=r.createContext(null);function i(e){let{children:t}=e;const n=(0,r.useState)({component:null,props:null});return r.createElement(o.Provider,{value:n},t)}function l(){const e=(0,r.useContext)(o);if(!e)throw new a.i6("NavbarSecondaryMenuContentProvider");return e[0]}function s(e){let{component:t,props:n}=e;const i=(0,r.useContext)(o);if(!i)throw new a.i6("NavbarSecondaryMenuContentProvider");const[,l]=i,s=(0,a.Ql)(n);return(0,r.useEffect)((()=>{l({component:t,props:s})}),[l,t,s]),(0,r.useEffect)((()=>()=>l({component:null,props:null})),[l]),null}},9727:(e,t,n)=>{"use strict";n.d(t,{h:()=>a,t:()=>o});var r=n(7294);const a="navigation-with-keyboard";function o(){(0,r.useEffect)((()=>{function e(e){"keydown"===e.type&&"Tab"===e.key&&document.body.classList.add(a),"mousedown"===e.type&&document.body.classList.remove(a)}return document.addEventListener("keydown",e),document.addEventListener("mousedown",e),()=>{document.body.classList.remove(a),document.removeEventListener("keydown",e),document.removeEventListener("mousedown",e)}}),[])}},6177:(e,t,n)=>{"use strict";n.d(t,{K:()=>i,M:()=>l});var r=n(7294),a=n(2263),o=n(1980);function i(){return(0,o.Nc)("q")}function l(){const{siteConfig:{baseUrl:e,themeConfig:t}}=(0,a.Z)(),{algolia:{searchPagePath:n}}=t;return(0,r.useCallback)((t=>`${e}${n}?q=${encodeURIComponent(t)}`),[e,n])}},7524:(e,t,n)=>{"use strict";n.d(t,{i:()=>c});var r=n(7294),a=n(412);const o="desktop",i="mobile",l="ssr";function s(){return a.Z.canUseDOM?window.innerWidth>996?o:i:l}function c(){const[e,t]=(0,r.useState)((()=>s()));return(0,r.useEffect)((()=>{function e(){t(s())}return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e),clearTimeout(undefined)}}),[]),e}},5281:(e,t,n)=>{"use strict";n.d(t,{k:()=>r});const r={page:{blogListPage:"blog-list-page",blogPostPage:"blog-post-page",blogTagsListPage:"blog-tags-list-page",blogTagPostListPage:"blog-tags-post-list-page",docsDocPage:"docs-doc-page",docsTagsListPage:"docs-tags-list-page",docsTagDocListPage:"docs-tags-doc-list-page",mdxPage:"mdx-page"},wrapper:{main:"main-wrapper",blogPages:"blog-wrapper",docsPages:"docs-wrapper",mdxPages:"mdx-wrapper"},common:{editThisPage:"theme-edit-this-page",lastUpdated:"theme-last-updated",backToTopButton:"theme-back-to-top-button",codeBlock:"theme-code-block",admonition:"theme-admonition",admonitionType:e=>`theme-admonition-${e}`},layout:{},docs:{docVersionBanner:"theme-doc-version-banner",docVersionBadge:"theme-doc-version-badge",docBreadcrumbs:"theme-doc-breadcrumbs",docMarkdown:"theme-doc-markdown",docTocMobile:"theme-doc-toc-mobile",docTocDesktop:"theme-doc-toc-desktop",docFooter:"theme-doc-footer",docFooterTagsRow:"theme-doc-footer-tags-row",docFooterEditMetaRow:"theme-doc-footer-edit-meta-row",docSidebarContainer:"theme-doc-sidebar-container",docSidebarMenu:"theme-doc-sidebar-menu",docSidebarItemCategory:"theme-doc-sidebar-item-category",docSidebarItemLink:"theme-doc-sidebar-item-link",docSidebarItemCategoryLevel:e=>`theme-doc-sidebar-item-category-level-${e}`,docSidebarItemLinkLevel:e=>`theme-doc-sidebar-item-link-level-${e}`},blog:{}}},1442:(e,t,n)=>{"use strict";function r(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}n.d(t,{n:()=>r})},2802:(e,t,n)=>{"use strict";n.d(t,{Wl:()=>p,_F:()=>m,cE:()=>d,hI:()=>w,lO:()=>b,vY:()=>y,oz:()=>v,s1:()=>g});var r=n(7294),a=n(6550),o=n(8790),i=n(143),l=n(373),s=n(1116);function c(e){return Array.from(new Set(e))}var u=n(8596);const d=!!i._r;function p(e){if(e.href)return e.href;for(const t of e.items){if("link"===t.type)return t.href;if("category"===t.type){const e=p(t);if(e)return e}}}const f=(e,t)=>void 0!==e&&(0,u.Mg)(e,t);function m(e,t){return"link"===e.type?f(e.href,t):"category"===e.type&&(f(e.href,t)||((e,t)=>e.some((e=>m(e,t))))(e.items,t))}function h(e){let{sidebarItems:t,pathname:n,onlyCategories:r=!1}=e;const a=[];return function e(t){for(const o of t)if("category"===o.type&&((0,u.Mg)(o.href,n)||e(o.items))||"link"===o.type&&(0,u.Mg)(o.href,n)){return r&&"category"!==o.type||a.unshift(o),!0}return!1}(t),a}function g(){var e;const t=(0,s.V)(),{pathname:n}=(0,a.TH)();return!1!==(null==(e=(0,i.gA)())?void 0:e.pluginData.breadcrumbs)&&t?h({sidebarItems:t.items,pathname:n}):null}function b(e){const{activeVersion:t}=(0,i.Iw)(e),{preferredVersion:n}=(0,l.J)(e),a=(0,i.yW)(e);return(0,r.useMemo)((()=>c([t,n,a].filter(Boolean))),[t,n,a])}function v(e,t){const n=b(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.sidebars?Object.entries(e.sidebars):[])),r=t.find((t=>t[0]===e));if(!r)throw new Error(`Can't find any sidebar with id "${e}" in version${n.length>1?"s":""} ${n.map((e=>e.name)).join(", ")}".\nAvailable sidebar ids are:\n- ${t.map((e=>e[0])).join("\n- ")}`);return r[1]}),[e,n])}function y(e,t){const n=b(t);return(0,r.useMemo)((()=>{const t=n.flatMap((e=>e.docs)),r=t.find((t=>t.id===e));if(!r){if(n.flatMap((e=>e.draftIds)).includes(e))return null;throw new Error(`Couldn't find any doc with id "${e}" in version${n.length>1?"s":""} "${n.map((e=>e.name)).join(", ")}".\nAvailable doc ids are:\n- ${c(t.map((e=>e.id))).join("\n- ")}`)}return r}),[e,n])}function w(e){let{route:t,versionMetadata:n}=e;const r=(0,a.TH)(),i=t.routes,l=i.find((e=>(0,a.LX)(r.pathname,e)));if(!l)return null;const s=l.sidebar,c=s?n.docsSidebars[s]:void 0;return{docElement:(0,o.H)(i),sidebarName:s,sidebarItems:c}}},2128:(e,t,n)=>{"use strict";n.d(t,{p:()=>a});var r=n(2263);function a(e){const{siteConfig:t}=(0,r.Z)(),{title:n,titleDelimiter:a}=t;return null!=e&&e.trim().length?`${e.trim()} ${a} ${n}`:n}},1980:(e,t,n)=>{"use strict";n.d(t,{Nc:()=>c,Rb:()=>l});var r=n(7294),a=n(6550),o=n(1688),i=n(902);function l(e){!function(e){const t=(0,a.k6)(),n=(0,i.zX)(e);(0,r.useEffect)((()=>t.block(((e,t)=>n(e,t)))),[t,n])}(((t,n)=>{if("POP"===n)return e(t,n)}))}function s(e){return function(e){const t=(0,a.k6)();return(0,o.useSyncExternalStore)(t.listen,(()=>e(t)),(()=>e(t)))}((t=>null===e?null:new URLSearchParams(t.location.search).get(e)))}function c(e){const t=s(e)??"",n=function(){const e=(0,a.k6)();return(0,r.useCallback)(((t,n,r)=>{const a=new URLSearchParams(e.location.search);n?a.set(t,n):a.delete(t),(null!=r&&r.push?e.push:e.replace)({search:a.toString()})}),[e])}();return[t,(0,r.useCallback)(((t,r)=>{n(e,t,r)}),[n,e])]}},833:(e,t,n)=>{"use strict";n.d(t,{FG:()=>p,d:()=>u,VC:()=>f});var r=n(7294),a=n(6010),o=n(5742),i=n(226);function l(){const e=r.useContext(i._);if(!e)throw new Error("Unexpected: no Docusaurus route context found");return e}var s=n(4996),c=n(2128);function u(e){let{title:t,description:n,keywords:a,image:i,children:l}=e;const u=(0,c.p)(t),{withBaseUrl:d}=(0,s.C)(),p=i?d(i,{absolute:!0}):void 0;return r.createElement(o.Z,null,t&&r.createElement("title",null,u),t&&r.createElement("meta",{property:"og:title",content:u}),n&&r.createElement("meta",{name:"description",content:n}),n&&r.createElement("meta",{property:"og:description",content:n}),a&&r.createElement("meta",{name:"keywords",content:Array.isArray(a)?a.join(","):a}),p&&r.createElement("meta",{property:"og:image",content:p}),p&&r.createElement("meta",{name:"twitter:image",content:p}),l)}const d=r.createContext(void 0);function p(e){let{className:t,children:n}=e;const i=r.useContext(d),l=(0,a.Z)(i,t);return r.createElement(d.Provider,{value:l},r.createElement(o.Z,null,r.createElement("html",{className:l})),n)}function f(e){let{children:t}=e;const n=l(),o=`plugin-${n.plugin.name.replace(/docusaurus-(?:plugin|theme)-(?:content-)?/gi,"")}`;const i=`plugin-id-${n.plugin.id}`;return r.createElement(p,{className:(0,a.Z)(o,i)},t)}},902:(e,t,n)=>{"use strict";n.d(t,{D9:()=>i,Qc:()=>c,Ql:()=>s,i6:()=>l,zX:()=>o});var r=n(7294);const a=n(412).Z.canUseDOM?r.useLayoutEffect:r.useEffect;function o(e){const t=(0,r.useRef)(e);return a((()=>{t.current=e}),[e]),(0,r.useCallback)((function(){return t.current(...arguments)}),[])}function i(e){const t=(0,r.useRef)();return a((()=>{t.current=e})),t.current}class l extends Error{constructor(e,t){var n,r,a;super(),this.name="ReactContextError",this.message=`Hook ${(null==(n=this.stack)||null==(r=n.split("\n")[1])||null==(a=r.match(/at (?:\w+\.)?(?\w+)/))?void 0:a.groups.name)??""} is called outside the <${e}>. ${t??""}`}}function s(e){const t=Object.entries(e);return t.sort(((e,t)=>e[0].localeCompare(t[0]))),(0,r.useMemo)((()=>e),t.flat())}function c(e){return t=>{let{children:n}=t;return r.createElement(r.Fragment,null,e.reduceRight(((e,t)=>r.createElement(t,null,e)),n))}}},8022:(e,t,n)=>{"use strict";function r(e,t){return void 0!==e&&void 0!==t&&new RegExp(e,"gi").test(t)}n.d(t,{F:()=>r})},8596:(e,t,n)=>{"use strict";n.d(t,{Mg:()=>i,Ns:()=>l});var r=n(7294),a=n(723),o=n(2263);function i(e,t){const n=e=>{var t;return null==(t=!e||e.endsWith("/")?e:`${e}/`)?void 0:t.toLowerCase()};return n(e)===n(t)}function l(){const{baseUrl:e}=(0,o.Z)().siteConfig;return(0,r.useMemo)((()=>function(e){let{baseUrl:t,routes:n}=e;function r(e){return e.path===t&&!0===e.exact}function a(e){return e.path===t&&!e.exact}return function e(t){if(0===t.length)return;return t.find(r)||e(t.filter(a).flatMap((e=>e.routes??[])))}(n)}({routes:a.Z,baseUrl:e})),[e])}},2466:(e,t,n)=>{"use strict";n.d(t,{Ct:()=>p,OC:()=>s,RF:()=>d});var r=n(7294),a=n(412),o=n(2389),i=n(902);const l=r.createContext(void 0);function s(e){let{children:t}=e;const n=function(){const e=(0,r.useRef)(!0);return(0,r.useMemo)((()=>({scrollEventsEnabledRef:e,enableScrollEvents:()=>{e.current=!0},disableScrollEvents:()=>{e.current=!1}})),[])}();return r.createElement(l.Provider,{value:n},t)}function c(){const e=(0,r.useContext)(l);if(null==e)throw new i.i6("ScrollControllerProvider");return e}const u=()=>a.Z.canUseDOM?{scrollX:window.pageXOffset,scrollY:window.pageYOffset}:null;function d(e,t){void 0===t&&(t=[]);const{scrollEventsEnabledRef:n}=c(),a=(0,r.useRef)(u()),o=(0,i.zX)(e);(0,r.useEffect)((()=>{const e=()=>{if(!n.current)return;const e=u();o(e,a.current),a.current=e},t={passive:!0};return e(),window.addEventListener("scroll",e,t),()=>window.removeEventListener("scroll",e,t)}),[o,n,...t])}function p(){const e=(0,r.useRef)(null),t=(0,o.Z)()&&"smooth"===getComputedStyle(document.documentElement).scrollBehavior;return{startScroll:n=>{e.current=t?function(e){return window.scrollTo({top:e,behavior:"smooth"}),()=>{}}(n):function(e){let t=null;const n=document.documentElement.scrollTop>e;return function r(){const a=document.documentElement.scrollTop;(n&&a>e||!n&&at&&cancelAnimationFrame(t)}(n)},cancelScroll:()=>null==e.current?void 0:e.current()}}},3320:(e,t,n)=>{"use strict";n.d(t,{HX:()=>i,_q:()=>s,os:()=>l});var r=n(143),a=n(2263),o=n(373);const i="default";function l(e,t){return`docs-${e}-${t}`}function s(){const{i18n:e}=(0,a.Z)(),t=(0,r._r)(),n=(0,r.WS)(),s=(0,o.Oh)();const c=[i,...Object.keys(t).map((function(e){const r=(null==n?void 0:n.activePlugin.pluginId)===e?n.activeVersion:void 0,a=s[e],o=t[e].versions.find((e=>e.isLast));return l(e,(r??a??o).name)}))];return{locale:e.currentLocale,tags:c}}},12:(e,t,n)=>{"use strict";n.d(t,{WA:()=>s});n(7294),n(1688);const r="localStorage";function a(e){let{key:t,oldValue:n,newValue:r,storage:a}=e;if(n===r)return;const o=document.createEvent("StorageEvent");o.initStorageEvent("storage",!1,!1,t,n,r,window.location.href,a),window.dispatchEvent(o)}function o(e){if(void 0===e&&(e=r),"undefined"==typeof window)throw new Error("Browser storage is not available on Node.js/Docusaurus SSR process.");if("none"===e)return null;try{return window[e]}catch(n){return t=n,i||(console.warn("Docusaurus browser storage is not available.\nPossible reasons: running Docusaurus in an iframe, in an incognito browser session, or using too strict browser privacy settings.",t),i=!0),null}var t}let i=!1;const l={get:()=>null,set:()=>{},del:()=>{},listen:()=>()=>{}};function s(e,t){if("undefined"==typeof window)return function(e){function t(){throw new Error(`Illegal storage API usage for storage key "${e}".\nDocusaurus storage APIs are not supposed to be called on the server-rendering process.\nPlease only call storage APIs in effects and event handlers.`)}return{get:t,set:t,del:t,listen:t}}(e);const n=o(null==t?void 0:t.persistence);return null===n?l:{get:()=>{try{return n.getItem(e)}catch(t){return console.error(`Docusaurus storage error, can't get key=${e}`,t),null}},set:t=>{try{const r=n.getItem(e);n.setItem(e,t),a({key:e,oldValue:r,newValue:t,storage:n})}catch(r){console.error(`Docusaurus storage error, can't set ${e}=${t}`,r)}},del:()=>{try{const t=n.getItem(e);n.removeItem(e),a({key:e,oldValue:t,newValue:null,storage:n})}catch(t){console.error(`Docusaurus storage error, can't delete key=${e}`,t)}},listen:t=>{try{const r=r=>{r.storageArea===n&&r.key===e&&t(r)};return window.addEventListener("storage",r),()=>window.removeEventListener("storage",r)}catch(r){return console.error(`Docusaurus storage error, can't listen for changes of key=${e}`,r),()=>{}}}}}},4711:(e,t,n)=>{"use strict";n.d(t,{l:()=>o});var r=n(2263),a=n(6550);function o(){const{siteConfig:{baseUrl:e,url:t},i18n:{defaultLocale:n,currentLocale:o}}=(0,r.Z)(),{pathname:i}=(0,a.TH)(),l=o===n?e:e.replace(`/${o}/`,"/"),s=i.replace(e,"");return{createUrl:function(e){let{locale:r,fullyQualified:a}=e;return`${a?t:""}${function(e){return e===n?`${l}`:`${l}${e}/`}(r)}${s}`}}}},5936:(e,t,n)=>{"use strict";n.d(t,{S:()=>i});var r=n(7294),a=n(6550),o=n(902);function i(e){const t=(0,a.TH)(),n=(0,o.D9)(t),i=(0,o.zX)(e);(0,r.useEffect)((()=>{n&&t!==n&&i({location:t,previousLocation:n})}),[i,t,n])}},6668:(e,t,n)=>{"use strict";n.d(t,{L:()=>a});var r=n(2263);function a(){return(0,r.Z)().siteConfig.themeConfig}},6278:(e,t,n)=>{"use strict";n.d(t,{L:()=>a});var r=n(2263);function a(){const{siteConfig:{themeConfig:e}}=(0,r.Z)();return e}},239:(e,t,n)=>{"use strict";n.d(t,{l:()=>l});var r=n(7294),a=n(8022),o=n(4996),i=n(6278);function l(){const{withBaseUrl:e}=(0,o.C)(),{algolia:{externalUrlRegex:t,replaceSearchResultPathname:n}}=(0,i.L)();return(0,r.useCallback)((r=>{const o=new URL(r);if((0,a.F)(t,o.href))return r;const i=`${o.pathname+o.hash}`;return e(function(e,t){return t?e.replaceAll(new RegExp(t.from,"g"),t.to):e}(i,n))}),[e,t,n])}},8802:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e,t){const{trailingSlash:n,baseUrl:r}=t;if(e.startsWith("#"))return e;if(void 0===n)return e;const[a]=e.split(/[#?]/),o="/"===a||a===r?a:(i=a,n?function(e){return e.endsWith("/")?e:`${e}/`}(i):function(e){return e.endsWith("/")?e.slice(0,-1):e}(i));var i;return e.replace(a,o)}},4143:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCausalChain=void 0,t.getErrorCausalChain=function e(t){return t.cause?[t,...e(t.cause)]:[t]}},8780:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.getErrorCausalChain=t.applyTrailingSlash=t.blogPostContainerID=void 0,t.blogPostContainerID="__blog-post-container";var a=n(8802);Object.defineProperty(t,"applyTrailingSlash",{enumerable:!0,get:function(){return r(a).default}});var o=n(4143);Object.defineProperty(t,"getErrorCausalChain",{enumerable:!0,get:function(){return o.getErrorCausalChain}})},6010:(e,t,n)=>{"use strict";function r(e){var t,n,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;ta});const a=function(){for(var e,t,n=0,a="";n{"use strict";n.d(t,{lX:()=>w,q_:()=>C,ob:()=>f,PP:()=>A,Ep:()=>p});var r=n(7462);function a(e){return"/"===e.charAt(0)}function o(e,t){for(var n=t,r=n+1,a=e.length;r=0;p--){var f=i[p];"."===f?o(i,p):".."===f?(o(i,p),d++):d&&(o(i,p),d--)}if(!c)for(;d--;d)i.unshift("..");!c||""===i[0]||i[0]&&a(i[0])||i.unshift("");var m=i.join("/");return n&&"/"!==m.substr(-1)&&(m+="/"),m};var l=n(8776);function s(e){return"/"===e.charAt(0)?e:"/"+e}function c(e){return"/"===e.charAt(0)?e.substr(1):e}function u(e,t){return function(e,t){return 0===e.toLowerCase().indexOf(t.toLowerCase())&&-1!=="/?#".indexOf(e.charAt(t.length))}(e,t)?e.substr(t.length):e}function d(e){return"/"===e.charAt(e.length-1)?e.slice(0,-1):e}function p(e){var t=e.pathname,n=e.search,r=e.hash,a=t||"/";return n&&"?"!==n&&(a+="?"===n.charAt(0)?n:"?"+n),r&&"#"!==r&&(a+="#"===r.charAt(0)?r:"#"+r),a}function f(e,t,n,a){var o;"string"==typeof e?(o=function(e){var t=e||"/",n="",r="",a=t.indexOf("#");-1!==a&&(r=t.substr(a),t=t.substr(0,a));var o=t.indexOf("?");return-1!==o&&(n=t.substr(o),t=t.substr(0,o)),{pathname:t,search:"?"===n?"":n,hash:"#"===r?"":r}}(e),o.state=t):(void 0===(o=(0,r.Z)({},e)).pathname&&(o.pathname=""),o.search?"?"!==o.search.charAt(0)&&(o.search="?"+o.search):o.search="",o.hash?"#"!==o.hash.charAt(0)&&(o.hash="#"+o.hash):o.hash="",void 0!==t&&void 0===o.state&&(o.state=t));try{o.pathname=decodeURI(o.pathname)}catch(l){throw l instanceof URIError?new URIError('Pathname "'+o.pathname+'" could not be decoded. This is likely caused by an invalid percent-encoding.'):l}return n&&(o.key=n),a?o.pathname?"/"!==o.pathname.charAt(0)&&(o.pathname=i(o.pathname,a.pathname)):o.pathname=a.pathname:o.pathname||(o.pathname="/"),o}function m(){var e=null;var t=[];return{setPrompt:function(t){return e=t,function(){e===t&&(e=null)}},confirmTransitionTo:function(t,n,r,a){if(null!=e){var o="function"==typeof e?e(t,n):e;"string"==typeof o?"function"==typeof r?r(o,a):a(!0):a(!1!==o)}else a(!0)},appendListener:function(e){var n=!0;function r(){n&&e.apply(void 0,arguments)}return t.push(r),function(){n=!1,t=t.filter((function(e){return e!==r}))}},notifyListeners:function(){for(var e=arguments.length,n=new Array(e),r=0;rt?n.splice(t,n.length-t,a):n.push(a),d({action:r,location:a,index:t,entries:n})}}))},replace:function(e,t){var r="REPLACE",a=f(e,t,h(),w.location);u.confirmTransitionTo(a,r,n,(function(e){e&&(w.entries[w.index]=a,d({action:r,location:a}))}))},go:y,goBack:function(){y(-1)},goForward:function(){y(1)},canGo:function(e){var t=w.index+e;return t>=0&&t{"use strict";var r=n(9864),a={childContextTypes:!0,contextType:!0,contextTypes:!0,defaultProps:!0,displayName:!0,getDefaultProps:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,mixins:!0,propTypes:!0,type:!0},o={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},i={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},l={};function s(e){return r.isMemo(e)?i:l[e.$$typeof]||a}l[r.ForwardRef]={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},l[r.Memo]=i;var c=Object.defineProperty,u=Object.getOwnPropertyNames,d=Object.getOwnPropertySymbols,p=Object.getOwnPropertyDescriptor,f=Object.getPrototypeOf,m=Object.prototype;e.exports=function e(t,n,r){if("string"!=typeof n){if(m){var a=f(n);a&&a!==m&&e(t,a,r)}var i=u(n);d&&(i=i.concat(d(n)));for(var l=s(t),h=s(n),g=0;g{"use strict";e.exports=function(e,t,n,r,a,o,i,l){if(!e){var s;if(void 0===t)s=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var c=[n,r,a,o,i,l],u=0;(s=new Error(t.replace(/%s/g,(function(){return c[u++]})))).name="Invariant Violation"}throw s.framesToPop=1,s}}},5826:e=>{e.exports=Array.isArray||function(e){return"[object Array]"==Object.prototype.toString.call(e)}},2497:(e,t,n)=>{"use strict";n.r(t)},2295:(e,t,n)=>{"use strict";n.r(t)},4865:function(e,t,n){var r,a;r=function(){var e,t,n={version:"0.2.0"},r=n.settings={minimum:.08,easing:"ease",positionUsing:"",speed:200,trickle:!0,trickleRate:.02,trickleSpeed:800,showSpinner:!0,barSelector:'[role="bar"]',spinnerSelector:'[role="spinner"]',parent:"body",template:'
'};function a(e,t,n){return en?n:e}function o(e){return 100*(-1+e)}function i(e,t,n){var a;return(a="translate3d"===r.positionUsing?{transform:"translate3d("+o(e)+"%,0,0)"}:"translate"===r.positionUsing?{transform:"translate("+o(e)+"%,0)"}:{"margin-left":o(e)+"%"}).transition="all "+t+"ms "+n,a}n.configure=function(e){var t,n;for(t in e)void 0!==(n=e[t])&&e.hasOwnProperty(t)&&(r[t]=n);return this},n.status=null,n.set=function(e){var t=n.isStarted();e=a(e,r.minimum,1),n.status=1===e?null:e;var o=n.render(!t),c=o.querySelector(r.barSelector),u=r.speed,d=r.easing;return o.offsetWidth,l((function(t){""===r.positionUsing&&(r.positionUsing=n.getPositioningCSS()),s(c,i(e,u,d)),1===e?(s(o,{transition:"none",opacity:1}),o.offsetWidth,setTimeout((function(){s(o,{transition:"all "+u+"ms linear",opacity:0}),setTimeout((function(){n.remove(),t()}),u)}),u)):setTimeout(t,u)})),this},n.isStarted=function(){return"number"==typeof n.status},n.start=function(){n.status||n.set(0);var e=function(){setTimeout((function(){n.status&&(n.trickle(),e())}),r.trickleSpeed)};return r.trickle&&e(),this},n.done=function(e){return e||n.status?n.inc(.3+.5*Math.random()).set(1):this},n.inc=function(e){var t=n.status;return t?("number"!=typeof e&&(e=(1-t)*a(Math.random()*t,.1,.95)),t=a(t+e,0,.994),n.set(t)):n.start()},n.trickle=function(){return n.inc(Math.random()*r.trickleRate)},e=0,t=0,n.promise=function(r){return r&&"resolved"!==r.state()?(0===t&&n.start(),e++,t++,r.always((function(){0==--t?(e=0,n.done()):n.set((e-t)/e)})),this):this},n.render=function(e){if(n.isRendered())return document.getElementById("nprogress");u(document.documentElement,"nprogress-busy");var t=document.createElement("div");t.id="nprogress",t.innerHTML=r.template;var a,i=t.querySelector(r.barSelector),l=e?"-100":o(n.status||0),c=document.querySelector(r.parent);return s(i,{transition:"all 0 linear",transform:"translate3d("+l+"%,0,0)"}),r.showSpinner||(a=t.querySelector(r.spinnerSelector))&&f(a),c!=document.body&&u(c,"nprogress-custom-parent"),c.appendChild(t),t},n.remove=function(){d(document.documentElement,"nprogress-busy"),d(document.querySelector(r.parent),"nprogress-custom-parent");var e=document.getElementById("nprogress");e&&f(e)},n.isRendered=function(){return!!document.getElementById("nprogress")},n.getPositioningCSS=function(){var e=document.body.style,t="WebkitTransform"in e?"Webkit":"MozTransform"in e?"Moz":"msTransform"in e?"ms":"OTransform"in e?"O":"";return t+"Perspective"in e?"translate3d":t+"Transform"in e?"translate":"margin"};var l=function(){var e=[];function t(){var n=e.shift();n&&n(t)}return function(n){e.push(n),1==e.length&&t()}}(),s=function(){var e=["Webkit","O","Moz","ms"],t={};function n(e){return e.replace(/^-ms-/,"ms-").replace(/-([\da-z])/gi,(function(e,t){return t.toUpperCase()}))}function r(t){var n=document.body.style;if(t in n)return t;for(var r,a=e.length,o=t.charAt(0).toUpperCase()+t.slice(1);a--;)if((r=e[a]+o)in n)return r;return t}function a(e){return e=n(e),t[e]||(t[e]=r(e))}function o(e,t,n){t=a(t),e.style[t]=n}return function(e,t){var n,r,a=arguments;if(2==a.length)for(n in t)void 0!==(r=t[n])&&t.hasOwnProperty(n)&&o(e,n,r);else o(e,a[1],a[2])}}();function c(e,t){return("string"==typeof e?e:p(e)).indexOf(" "+t+" ")>=0}function u(e,t){var n=p(e),r=n+t;c(n,t)||(e.className=r.substring(1))}function d(e,t){var n,r=p(e);c(e,t)&&(n=r.replace(" "+t+" "," "),e.className=n.substring(1,n.length-1))}function p(e){return(" "+(e.className||"")+" ").replace(/\s+/gi," ")}function f(e){e&&e.parentNode&&e.parentNode.removeChild(e)}return n},void 0===(a="function"==typeof r?r.call(t,n,t,e):r)||(e.exports=a)},7418:e=>{"use strict";var t=Object.getOwnPropertySymbols,n=Object.prototype.hasOwnProperty,r=Object.prototype.propertyIsEnumerable;function a(e){if(null==e)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(e)}e.exports=function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},n=0;n<10;n++)t["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(t).map((function(e){return t[e]})).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach((function(e){r[e]=e})),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(a){return!1}}()?Object.assign:function(e,o){for(var i,l,s=a(e),c=1;c{"use strict";n.d(t,{Z:()=>o});var r=function(){var e=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,t=0,n={},r={util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,"&").replace(/=d.reach);S+=E.value.length,E=E.next){var x=E.value;if(t.length>e.length)return;if(!(x instanceof a)){var T,C=1;if(v){if(!(T=o(k,S,e,b))||T.index>=e.length)break;var _=T.index,A=T.index+T[0].length,O=S;for(O+=E.value.length;_>=O;)O+=(E=E.next).value.length;if(S=O-=E.value.length,E.value instanceof a)continue;for(var R=E;R!==t.tail&&(Od.reach&&(d.reach=N);var D=E.prev;if(I&&(D=s(t,D,I),S+=I.length),c(t,D,C),E=s(t,D,new a(p,g?r.tokenize(L,g):L,y,L)),P&&s(t,E,P),C>1){var M={cause:p+","+m,reach:N};i(e,t,n,E.prev,S,M),d&&M.reach>d.reach&&(d.reach=M.reach)}}}}}}function l(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function s(e,t,n){var r=t.next,a={value:n,prev:t,next:r};return t.next=a,r.prev=a,e.length++,a}function c(e,t,n){for(var r=t.next,a=0;a"+o.content+""},r}(),a=r;r.default=r,a.languages.markup={comment:{pattern://,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern://i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},a.languages.markup.tag.inside["attr-value"].inside.entity=a.languages.markup.entity,a.languages.markup.doctype.inside["internal-subset"].inside=a.languages.markup,a.hooks.add("wrap",(function(e){"entity"===e.type&&(e.attributes.title=e.content.replace(/&/,"&"))})),Object.defineProperty(a.languages.markup.tag,"addInlined",{value:function(e,t){var n={};n["language-"+t]={pattern:/(^$)/i,lookbehind:!0,inside:a.languages[t]},n.cdata=/^$/i;var r={"included-cdata":{pattern://i,inside:n}};r["language-"+t]={pattern:/[\s\S]+/,inside:a.languages[t]};var o={};o[e]={pattern:RegExp(/(<__[^>]*>)(?:))*\]\]>|(?!)/.source.replace(/__/g,(function(){return e})),"i"),lookbehind:!0,greedy:!0,inside:r},a.languages.insertBefore("markup","cdata",o)}}),Object.defineProperty(a.languages.markup.tag,"addAttribute",{value:function(e,t){a.languages.markup.tag.inside["special-attr"].push({pattern:RegExp(/(^|["'\s])/.source+"(?:"+e+")"+/\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))/.source,"i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,"language-"+t],inside:a.languages[t]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),a.languages.html=a.languages.markup,a.languages.mathml=a.languages.markup,a.languages.svg=a.languages.markup,a.languages.xml=a.languages.extend("markup",{}),a.languages.ssml=a.languages.xml,a.languages.atom=a.languages.xml,a.languages.rss=a.languages.xml,function(e){var t="\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b",n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:"punctuation",inside:null},r={bash:n,environment:{pattern:RegExp("\\$"+t),alias:"constant"},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp("(\\{)"+t),lookbehind:!0,alias:"constant"}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:"important"},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:"function"},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:"function"}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:"variable",lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?=\+?=)/,inside:{environment:{pattern:RegExp("(^|[\\s;|&]|[<>]\\()"+t),lookbehind:!0,alias:"constant"}},alias:"variable",lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp("\\$?"+t),alias:"constant"},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:"class-name"},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:"important"},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:"important"}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var a=["comment","function-name","for-or-select","assign-left","string","environment","function","keyword","builtin","boolean","file-descriptor","operator","punctuation","number"],o=r.variable[1].inside,i=0;i]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},a.languages.c=a.languages.extend("clike",{comment:{pattern:/\/\/(?:[^\r\n\\]|\\(?:\r\n?|\n|(?![\r\n])))*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},"class-name":{pattern:/(\b(?:enum|struct)\s+(?:__attribute__\s*\(\([\s\S]*?\)\)\s*)?)\w+|\b[a-z]\w*_t\b/,lookbehind:!0},keyword:/\b(?:_Alignas|_Alignof|_Atomic|_Bool|_Complex|_Generic|_Imaginary|_Noreturn|_Static_assert|_Thread_local|__attribute__|asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|inline|int|long|register|return|short|signed|sizeof|static|struct|switch|typedef|typeof|union|unsigned|void|volatile|while)\b/,function:/\b[a-z_]\w*(?=\s*\()/i,number:/(?:\b0x(?:[\da-f]+(?:\.[\da-f]*)?|\.[\da-f]+)(?:p[+-]?\d+)?|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?)[ful]{0,4}/i,operator:/>>=?|<<=?|->|([-+&|:])\1|[?:~]|[-+*/%&|^!=<>]=?/}),a.languages.insertBefore("c","string",{char:{pattern:/'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n]){0,32}'/,greedy:!0}}),a.languages.insertBefore("c","string",{macro:{pattern:/(^[\t ]*)#\s*[a-z](?:[^\r\n\\/]|\/(?!\*)|\/\*(?:[^*]|\*(?!\/))*\*\/|\\(?:\r\n|[\s\S]))*/im,lookbehind:!0,greedy:!0,alias:"property",inside:{string:[{pattern:/^(#\s*include\s*)<[^>]+>/,lookbehind:!0},a.languages.c.string],char:a.languages.c.char,comment:a.languages.c.comment,"macro-name":[{pattern:/(^#\s*define\s+)\w+\b(?!\()/i,lookbehind:!0},{pattern:/(^#\s*define\s+)\w+\b(?=\()/i,lookbehind:!0,alias:"function"}],directive:{pattern:/^(#\s*)[a-z]+/,lookbehind:!0,alias:"keyword"},"directive-hash":/^#/,punctuation:/##|\\(?=[\r\n])/,expression:{pattern:/\S[\s\S]*/,inside:a.languages.c}}}}),a.languages.insertBefore("c","function",{constant:/\b(?:EOF|NULL|SEEK_CUR|SEEK_END|SEEK_SET|__DATE__|__FILE__|__LINE__|__TIMESTAMP__|__TIME__|__func__|stderr|stdin|stdout)\b/}),delete a.languages.c.boolean,function(e){var t=/\b(?:alignas|alignof|asm|auto|bool|break|case|catch|char|char16_t|char32_t|char8_t|class|co_await|co_return|co_yield|compl|concept|const|const_cast|consteval|constexpr|constinit|continue|decltype|default|delete|do|double|dynamic_cast|else|enum|explicit|export|extern|final|float|for|friend|goto|if|import|inline|int|int16_t|int32_t|int64_t|int8_t|long|module|mutable|namespace|new|noexcept|nullptr|operator|override|private|protected|public|register|reinterpret_cast|requires|return|short|signed|sizeof|static|static_assert|static_cast|struct|switch|template|this|thread_local|throw|try|typedef|typeid|typename|uint16_t|uint32_t|uint64_t|uint8_t|union|unsigned|using|virtual|void|volatile|wchar_t|while)\b/,n=/\b(?!)\w+(?:\s*\.\s*\w+)*\b/.source.replace(//g,(function(){return t.source}));e.languages.cpp=e.languages.extend("c",{"class-name":[{pattern:RegExp(/(\b(?:class|concept|enum|struct|typename)\s+)(?!)\w+/.source.replace(//g,(function(){return t.source}))),lookbehind:!0},/\b[A-Z]\w*(?=\s*::\s*\w+\s*\()/,/\b[A-Z_]\w*(?=\s*::\s*~\w+\s*\()/i,/\b\w+(?=\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>\s*::\s*\w+\s*\()/],keyword:t,number:{pattern:/(?:\b0b[01']+|\b0x(?:[\da-f']+(?:\.[\da-f']*)?|\.[\da-f']+)(?:p[+-]?[\d']+)?|(?:\b[\d']+(?:\.[\d']*)?|\B\.[\d']+)(?:e[+-]?[\d']+)?)[ful]{0,4}/i,greedy:!0},operator:/>>=?|<<=?|->|--|\+\+|&&|\|\||[?:~]|<=>|[-+*/%&|^!=<>]=?|\b(?:and|and_eq|bitand|bitor|not|not_eq|or|or_eq|xor|xor_eq)\b/,boolean:/\b(?:false|true)\b/}),e.languages.insertBefore("cpp","string",{module:{pattern:RegExp(/(\b(?:import|module)\s+)/.source+"(?:"+/"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|<[^<>\r\n]*>/.source+"|"+/(?:\s*:\s*)?|:\s*/.source.replace(//g,(function(){return n}))+")"),lookbehind:!0,greedy:!0,inside:{string:/^[<"][\s\S]+/,operator:/:/,punctuation:/\./}},"raw-string":{pattern:/R"([^()\\ ]{0,16})\([\s\S]*?\)\1"/,alias:"string",greedy:!0}}),e.languages.insertBefore("cpp","keyword",{"generic-function":{pattern:/\b(?!operator\b)[a-z_]\w*\s*<(?:[^<>]|<[^<>]*>)*>(?=\s*\()/i,inside:{function:/^\w+/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:e.languages.cpp}}}}),e.languages.insertBefore("cpp","operator",{"double-colon":{pattern:/::/,alias:"punctuation"}}),e.languages.insertBefore("cpp","class-name",{"base-clause":{pattern:/(\b(?:class|struct)\s+\w+\s*:\s*)[^;{}"'\s]+(?:\s+[^;{}"'\s]+)*(?=\s*[;{])/,lookbehind:!0,greedy:!0,inside:e.languages.extend("cpp",{})}}),e.languages.insertBefore("inside","double-colon",{"class-name":/\b[a-z_]\w*\b(?!\s*::)/i},e.languages.cpp["base-clause"])}(a),function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+t.source+"|"+/(?:[^\\\r\n()"']|\\[\s\S])*/.source+")\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+t.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+t.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined("style","css"),n.tag.addAttribute("style","css"))}(a),function(e){var t,n=/("|')(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/;e.languages.css.selector={pattern:e.languages.css.selector.pattern,lookbehind:!0,inside:t={"pseudo-element":/:(?:after|before|first-letter|first-line|selection)|::[-\w]+/,"pseudo-class":/:[-\w]+/,class:/\.[-\w]+/,id:/#[-\w]+/,attribute:{pattern:RegExp("\\[(?:[^[\\]\"']|"+n.source+")*\\]"),greedy:!0,inside:{punctuation:/^\[|\]$/,"case-sensitivity":{pattern:/(\s)[si]$/i,lookbehind:!0,alias:"keyword"},namespace:{pattern:/^(\s*)(?:(?!\s)[-*\w\xA0-\uFFFF])*\|(?!=)/,lookbehind:!0,inside:{punctuation:/\|$/}},"attr-name":{pattern:/^(\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+/,lookbehind:!0},"attr-value":[n,{pattern:/(=\s*)(?:(?!\s)[-\w\xA0-\uFFFF])+(?=\s*$)/,lookbehind:!0}],operator:/[|~*^$]?=/}},"n-th":[{pattern:/(\(\s*)[+-]?\d*[\dn](?:\s*[+-]\s*\d+)?(?=\s*\))/,lookbehind:!0,inside:{number:/[\dn]+/,operator:/[+-]/}},{pattern:/(\(\s*)(?:even|odd)(?=\s*\))/i,lookbehind:!0}],combinator:/>|\+|~|\|\|/,punctuation:/[(),]/}},e.languages.css.atrule.inside["selector-function-argument"].inside=t,e.languages.insertBefore("css","property",{variable:{pattern:/(^|[^-\w\xA0-\uFFFF])--(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*/i,lookbehind:!0}});var r={pattern:/(\b\d+)(?:%|[a-z]+(?![\w-]))/,lookbehind:!0},a={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0};e.languages.insertBefore("css","function",{operator:{pattern:/(\s)[+\-*\/](?=\s)/,lookbehind:!0},hexcode:{pattern:/\B#[\da-f]{3,8}\b/i,alias:"color"},color:[{pattern:/(^|[^\w-])(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)(?![\w-])/i,lookbehind:!0},{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:r,number:a,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:r,number:a})}(a),a.languages.javascript=a.languages.extend("clike",{"class-name":[a.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(/(^|[^\w$])/.source+"(?:"+/NaN|Infinity/.source+"|"+/0[bB][01]+(?:_[01]+)*n?/.source+"|"+/0[oO][0-7]+(?:_[0-7]+)*n?/.source+"|"+/0[xX][\dA-Fa-f]+(?:_[\dA-Fa-f]+)*n?/.source+"|"+/\d+(?:_\d+)*n/.source+"|"+/(?:\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\.\d+(?:_\d+)*)(?:[Ee][+-]?\d+(?:_\d+)*)?/.source+")"+/(?![\w$])/.source),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),a.languages.javascript["class-name"][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,a.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*\]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:a.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:a.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:a.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:a.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:a.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),a.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:a.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:"property"}}),a.languages.insertBefore("javascript","operator",{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:"property"}}),a.languages.markup&&(a.languages.markup.tag.addInlined("script","javascript"),a.languages.markup.tag.addAttribute(/on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)/.source,"javascript")),a.languages.js=a.languages.javascript,function(e){var t=/#(?!\{).+/,n={pattern:/#\{[^}]+\}/,alias:"variable"};e.languages.coffeescript=e.languages.extend("javascript",{comment:t,string:[{pattern:/'(?:\\[\s\S]|[^\\'])*'/,greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,greedy:!0,inside:{interpolation:n}}],keyword:/\b(?:and|break|by|catch|class|continue|debugger|delete|do|each|else|extend|extends|false|finally|for|if|in|instanceof|is|isnt|let|loop|namespace|new|no|not|null|of|off|on|or|own|return|super|switch|then|this|throw|true|try|typeof|undefined|unless|until|when|while|window|with|yes|yield)\b/,"class-member":{pattern:/@(?!\d)\w+/,alias:"variable"}}),e.languages.insertBefore("coffeescript","comment",{"multiline-comment":{pattern:/###[\s\S]+?###/,alias:"comment"},"block-regex":{pattern:/\/{3}[\s\S]*?\/{3}/,alias:"regex",inside:{comment:t,interpolation:n}}}),e.languages.insertBefore("coffeescript","string",{"inline-javascript":{pattern:/`(?:\\[\s\S]|[^\\`])*`/,inside:{delimiter:{pattern:/^`|`$/,alias:"punctuation"},script:{pattern:/[\s\S]+/,alias:"language-javascript",inside:e.languages.javascript}}},"multiline-string":[{pattern:/'''[\s\S]*?'''/,greedy:!0,alias:"string"},{pattern:/"""[\s\S]*?"""/,greedy:!0,alias:"string",inside:{interpolation:n}}]}),e.languages.insertBefore("coffeescript","keyword",{property:/(?!\d)\w+(?=\s*:(?!:))/}),delete e.languages.coffeescript["template-string"],e.languages.coffee=e.languages.coffeescript}(a),function(e){var t=/[*&][^\s[\]{},]+/,n=/!(?:<[\w\-%#;/?:@&=+$,.!~*'()[\]]+>|(?:[a-zA-Z\d-]*!)?[\w\-%#;/?:@&=+$.~*'()]+)?/,r="(?:"+n.source+"(?:[ \t]+"+t.source+")?|"+t.source+"(?:[ \t]+"+n.source+")?)",a=/(?:[^\s\x00-\x08\x0e-\x1f!"#%&'*,\-:>?@[\]`{|}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]|[?:-])(?:[ \t]*(?:(?![#:])|:))*/.source.replace(//g,(function(){return/[^\s\x00-\x08\x0e-\x1f,[\]{}\x7f-\x84\x86-\x9f\ud800-\udfff\ufffe\uffff]/.source})),o=/"(?:[^"\\\r\n]|\\.)*"|'(?:[^'\\\r\n]|\\.)*'/.source;function i(e,t){t=(t||"").replace(/m/g,"")+"m";var n=/([:\-,[{]\s*(?:\s<>[ \t]+)?)(?:<>)(?=[ \t]*(?:$|,|\]|\}|(?:[\r\n]\s*)?#))/.source.replace(/<>/g,(function(){return r})).replace(/<>/g,(function(){return e}));return RegExp(n,t)}e.languages.yaml={scalar:{pattern:RegExp(/([\-:]\s*(?:\s<>[ \t]+)?[|>])[ \t]*(?:((?:\r?\n|\r)[ \t]+)\S[^\r\n]*(?:\2[^\r\n]+)*)/.source.replace(/<>/g,(function(){return r}))),lookbehind:!0,alias:"string"},comment:/#.*/,key:{pattern:RegExp(/((?:^|[:\-,[{\r\n?])[ \t]*(?:<>[ \t]+)?)<>(?=\s*:\s)/.source.replace(/<>/g,(function(){return r})).replace(/<>/g,(function(){return"(?:"+a+"|"+o+")"}))),lookbehind:!0,greedy:!0,alias:"atrule"},directive:{pattern:/(^[ \t]*)%.+/m,lookbehind:!0,alias:"important"},datetime:{pattern:i(/\d{4}-\d\d?-\d\d?(?:[tT]|[ \t]+)\d\d?:\d{2}:\d{2}(?:\.\d*)?(?:[ \t]*(?:Z|[-+]\d\d?(?::\d{2})?))?|\d{4}-\d{2}-\d{2}|\d\d?:\d{2}(?::\d{2}(?:\.\d*)?)?/.source),lookbehind:!0,alias:"number"},boolean:{pattern:i(/false|true/.source,"i"),lookbehind:!0,alias:"important"},null:{pattern:i(/null|~/.source,"i"),lookbehind:!0,alias:"important"},string:{pattern:i(o),lookbehind:!0,greedy:!0},number:{pattern:i(/[+-]?(?:0x[\da-f]+|0o[0-7]+|(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?|\.inf|\.nan)/.source,"i"),lookbehind:!0},tag:n,important:t,punctuation:/---|[:[\]{}\-,|>?]|\.\.\./},e.languages.yml=e.languages.yaml}(a),function(e){var t=/(?:\\.|[^\\\n\r]|(?:\n|\r\n?)(?![\r\n]))/.source;function n(e){return e=e.replace(//g,(function(){return t})),RegExp(/((?:^|[^\\])(?:\\{2})*)/.source+"(?:"+e+")")}var r=/(?:\\.|``(?:[^`\r\n]|`(?!`))+``|`[^`\r\n]+`|[^\\|\r\n`])+/.source,a=/\|?__(?:\|__)+\|?(?:(?:\n|\r\n?)|(?![\s\S]))/.source.replace(/__/g,(function(){return r})),o=/\|?[ \t]*:?-{3,}:?[ \t]*(?:\|[ \t]*:?-{3,}:?[ \t]*)+\|?(?:\n|\r\n?)/.source;e.languages.markdown=e.languages.extend("markup",{}),e.languages.insertBefore("markdown","prolog",{"front-matter-block":{pattern:/(^(?:\s*[\r\n])?)---(?!.)[\s\S]*?[\r\n]---(?!.)/,lookbehind:!0,greedy:!0,inside:{punctuation:/^---|---$/,"front-matter":{pattern:/\S+(?:\s+\S+)*/,alias:["yaml","language-yaml"],inside:e.languages.yaml}}},blockquote:{pattern:/^>(?:[\t ]*>)*/m,alias:"punctuation"},table:{pattern:RegExp("^"+a+o+"(?:"+a+")*","m"),inside:{"table-data-rows":{pattern:RegExp("^("+a+o+")(?:"+a+")*$"),lookbehind:!0,inside:{"table-data":{pattern:RegExp(r),inside:e.languages.markdown},punctuation:/\|/}},"table-line":{pattern:RegExp("^("+a+")"+o+"$"),lookbehind:!0,inside:{punctuation:/\||:?-{3,}:?/}},"table-header-row":{pattern:RegExp("^"+a+"$"),inside:{"table-header":{pattern:RegExp(r),alias:"important",inside:e.languages.markdown},punctuation:/\|/}}}},code:[{pattern:/((?:^|\n)[ \t]*\n|(?:^|\r\n?)[ \t]*\r\n?)(?: {4}|\t).+(?:(?:\n|\r\n?)(?: {4}|\t).+)*/,lookbehind:!0,alias:"keyword"},{pattern:/^```[\s\S]*?^```$/m,greedy:!0,inside:{"code-block":{pattern:/^(```.*(?:\n|\r\n?))[\s\S]+?(?=(?:\n|\r\n?)^```$)/m,lookbehind:!0},"code-language":{pattern:/^(```).+/,lookbehind:!0},punctuation:/```/}}],title:[{pattern:/\S.*(?:\n|\r\n?)(?:==+|--+)(?=[ \t]*$)/m,alias:"important",inside:{punctuation:/==+$|--+$/}},{pattern:/(^\s*)#.+/m,lookbehind:!0,alias:"important",inside:{punctuation:/^#+|#+$/}}],hr:{pattern:/(^\s*)([*-])(?:[\t ]*\2){2,}(?=\s*$)/m,lookbehind:!0,alias:"punctuation"},list:{pattern:/(^\s*)(?:[*+-]|\d+\.)(?=[\t ].)/m,lookbehind:!0,alias:"punctuation"},"url-reference":{pattern:/!?\[[^\]]+\]:[\t ]+(?:\S+|<(?:\\.|[^>\\])+>)(?:[\t ]+(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\)))?/,inside:{variable:{pattern:/^(!?\[)[^\]]+/,lookbehind:!0},string:/(?:"(?:\\.|[^"\\])*"|'(?:\\.|[^'\\])*'|\((?:\\.|[^)\\])*\))$/,punctuation:/^[\[\]!:]|[<>]/},alias:"url"},bold:{pattern:n(/\b__(?:(?!_)|_(?:(?!_))+_)+__\b|\*\*(?:(?!\*)|\*(?:(?!\*))+\*)+\*\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^..)[\s\S]+(?=..$)/,lookbehind:!0,inside:{}},punctuation:/\*\*|__/}},italic:{pattern:n(/\b_(?:(?!_)|__(?:(?!_))+__)+_\b|\*(?:(?!\*)|\*\*(?:(?!\*))+\*\*)+\*/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^.)[\s\S]+(?=.$)/,lookbehind:!0,inside:{}},punctuation:/[*_]/}},strike:{pattern:n(/(~~?)(?:(?!~))+\2/.source),lookbehind:!0,greedy:!0,inside:{content:{pattern:/(^~~?)[\s\S]+(?=\1$)/,lookbehind:!0,inside:{}},punctuation:/~~?/}},"code-snippet":{pattern:/(^|[^\\`])(?:``[^`\r\n]+(?:`[^`\r\n]+)*``(?!`)|`[^`\r\n]+`(?!`))/,lookbehind:!0,greedy:!0,alias:["code","keyword"]},url:{pattern:n(/!?\[(?:(?!\]))+\](?:\([^\s)]+(?:[\t ]+"(?:\\.|[^"\\])*")?\)|[ \t]?\[(?:(?!\]))+\])/.source),lookbehind:!0,greedy:!0,inside:{operator:/^!/,content:{pattern:/(^\[)[^\]]+(?=\])/,lookbehind:!0,inside:{}},variable:{pattern:/(^\][ \t]?\[)[^\]]+(?=\]$)/,lookbehind:!0},url:{pattern:/(^\]\()[^\s)]+/,lookbehind:!0},string:{pattern:/(^[ \t]+)"(?:\\.|[^"\\])*"(?=\)$)/,lookbehind:!0}}}}),["url","bold","italic","strike"].forEach((function(t){["url","bold","italic","strike","code-snippet"].forEach((function(n){t!==n&&(e.languages.markdown[t].inside.content.inside[n]=e.languages.markdown[n])}))})),e.hooks.add("after-tokenize",(function(e){"markdown"!==e.language&&"md"!==e.language||function e(t){if(t&&"string"!=typeof t)for(var n=0,r=t.length;n",quot:'"'},s=String.fromCodePoint||String.fromCharCode;e.languages.md=e.languages.markdown}(a),a.languages.graphql={comment:/#.*/,description:{pattern:/(?:"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*")(?=\s*[a-z_])/i,greedy:!0,alias:"string",inside:{"language-markdown":{pattern:/(^"(?:"")?)(?!\1)[\s\S]+(?=\1$)/,lookbehind:!0,inside:a.languages.markdown}}},string:{pattern:/"""(?:[^"]|(?!""")")*"""|"(?:\\.|[^\\"\r\n])*"/,greedy:!0},number:/(?:\B-|\b)\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,boolean:/\b(?:false|true)\b/,variable:/\$[a-z_]\w*/i,directive:{pattern:/@[a-z_]\w*/i,alias:"function"},"attr-name":{pattern:/\b[a-z_]\w*(?=\s*(?:\((?:[^()"]|"(?:\\.|[^\\"\r\n])*")*\))?:)/i,greedy:!0},"atom-input":{pattern:/\b[A-Z]\w*Input\b/,alias:"class-name"},scalar:/\b(?:Boolean|Float|ID|Int|String)\b/,constant:/\b[A-Z][A-Z_\d]*\b/,"class-name":{pattern:/(\b(?:enum|implements|interface|on|scalar|type|union)\s+|&\s*|:\s*|\[)[A-Z_]\w*/,lookbehind:!0},fragment:{pattern:/(\bfragment\s+|\.{3}\s*(?!on\b))[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-mutation":{pattern:/(\bmutation\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},"definition-query":{pattern:/(\bquery\s+)[a-zA-Z_]\w*/,lookbehind:!0,alias:"function"},keyword:/\b(?:directive|enum|extend|fragment|implements|input|interface|mutation|on|query|repeatable|scalar|schema|subscription|type|union)\b/,operator:/[!=|&]|\.{3}/,"property-query":/\w+(?=\s*\()/,object:/\w+(?=\s*\{)/,punctuation:/[!(){}\[\]:=,]/,property:/\w+/},a.hooks.add("after-tokenize",(function(e){if("graphql"===e.language)for(var t=e.tokens.filter((function(e){return"string"!=typeof e&&"comment"!==e.type&&"scalar"!==e.type})),n=0;n0)){var l=p(/^\{$/,/^\}$/);if(-1===l)continue;for(var s=n;s=0&&f(c,"variable-input")}}}}function u(e){return t[n+e]}function d(e,t){t=t||0;for(var n=0;n?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|DIV|ILIKE|IN|IS|LIKE|NOT|OR|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/},function(e){var t=e.languages.javascript["template-string"],n=t.pattern.source,r=t.inside.interpolation,a=r.inside["interpolation-punctuation"],o=r.pattern.source;function i(t,r){if(e.languages[t])return{pattern:RegExp("((?:"+r+")\\s*)"+n),lookbehind:!0,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},"embedded-code":{pattern:/[\s\S]+/,alias:t}}}}function l(e,t){return"___"+t.toUpperCase()+"_"+e+"___"}function s(t,n,r){var a={code:t,grammar:n,language:r};return e.hooks.run("before-tokenize",a),a.tokens=e.tokenize(a.code,a.grammar),e.hooks.run("after-tokenize",a),a.tokens}function c(t){var n={};n["interpolation-punctuation"]=a;var o=e.tokenize(t,n);if(3===o.length){var i=[1,1];i.push.apply(i,s(o[1],e.languages.javascript,"javascript")),o.splice.apply(o,i)}return new e.Token("interpolation",o,r.alias,t)}function u(t,n,r){var a=e.tokenize(t,{interpolation:{pattern:RegExp(o),lookbehind:!0}}),i=0,u={},d=s(a.map((function(e){if("string"==typeof e)return e;for(var n,a=e.content;-1!==t.indexOf(n=l(i++,r)););return u[n]=a,n})).join(""),n,r),p=Object.keys(u);return i=0,function e(t){for(var n=0;n=p.length)return;var r=t[n];if("string"==typeof r||"string"==typeof r.content){var a=p[i],o="string"==typeof r?r:r.content,l=o.indexOf(a);if(-1!==l){++i;var s=o.substring(0,l),d=c(u[a]),f=o.substring(l+a.length),m=[];if(s&&m.push(s),m.push(d),f){var h=[f];e(h),m.push.apply(m,h)}"string"==typeof r?(t.splice.apply(t,[n,1].concat(m)),n+=m.length-1):r.content=m}}else{var g=r.content;Array.isArray(g)?e(g):e([g])}}}(d),new e.Token(r,d,"language-"+r,t)}e.languages.javascript["template-string"]=[i("css",/\b(?:styled(?:\([^)]*\))?(?:\s*\.\s*\w+(?:\([^)]*\))*)*|css(?:\s*\.\s*(?:global|resolve))?|createGlobalStyle|keyframes)/.source),i("html",/\bhtml|\.\s*(?:inner|outer)HTML\s*\+?=/.source),i("svg",/\bsvg/.source),i("markdown",/\b(?:markdown|md)/.source),i("graphql",/\b(?:gql|graphql(?:\s*\.\s*experimental)?)/.source),i("sql",/\bsql/.source),t].filter(Boolean);var d={javascript:!0,js:!0,typescript:!0,ts:!0,jsx:!0,tsx:!0};function p(e){return"string"==typeof e?e:Array.isArray(e)?e.map(p).join(""):p(e.content)}e.hooks.add("after-tokenize",(function(t){t.language in d&&function t(n){for(var r=0,a=n.length;r]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript["literal-property"];var t=e.languages.extend("typescript",{});delete t["class-name"],e.languages.typescript["class-name"].inside=t,e.languages.insertBefore("typescript","function",{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:"operator"},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:"class-name",inside:t}}}}),e.languages.ts=e.languages.typescript}(a),function(e){function t(e,t){return RegExp(e.replace(//g,(function(){return/(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/.source})),t)}e.languages.insertBefore("javascript","function-variable",{"method-variable":{pattern:RegExp("(\\.\\s*)"+e.languages.javascript["function-variable"].pattern.source),lookbehind:!0,alias:["function-variable","method","function","property-access"]}}),e.languages.insertBefore("javascript","function",{method:{pattern:RegExp("(\\.\\s*)"+e.languages.javascript.function.source),lookbehind:!0,alias:["function","property-access"]}}),e.languages.insertBefore("javascript","constant",{"known-class-name":[{pattern:/\b(?:(?:Float(?:32|64)|(?:Int|Uint)(?:8|16|32)|Uint8Clamped)?Array|ArrayBuffer|BigInt|Boolean|DataView|Date|Error|Function|Intl|JSON|(?:Weak)?(?:Map|Set)|Math|Number|Object|Promise|Proxy|Reflect|RegExp|String|Symbol|WebAssembly)\b/,alias:"class-name"},{pattern:/\b(?:[A-Z]\w*)Error\b/,alias:"class-name"}]}),e.languages.insertBefore("javascript","keyword",{imports:{pattern:t(/(\bimport\b\s*)(?:(?:\s*,\s*(?:\*\s*as\s+|\{[^{}]*\}))?|\*\s*as\s+|\{[^{}]*\})(?=\s*\bfrom\b)/.source),lookbehind:!0,inside:e.languages.javascript},exports:{pattern:t(/(\bexport\b\s*)(?:\*(?:\s*as\s+)?(?=\s*\bfrom\b)|\{[^{}]*\})/.source),lookbehind:!0,inside:e.languages.javascript}}),e.languages.javascript.keyword.unshift({pattern:/\b(?:as|default|export|from|import)\b/,alias:"module"},{pattern:/\b(?:await|break|catch|continue|do|else|finally|for|if|return|switch|throw|try|while|yield)\b/,alias:"control-flow"},{pattern:/\bnull\b/,alias:["null","nil"]},{pattern:/\bundefined\b/,alias:"nil"}),e.languages.insertBefore("javascript","operator",{spread:{pattern:/\.{3}/,alias:"operator"},arrow:{pattern:/=>/,alias:"operator"}}),e.languages.insertBefore("javascript","punctuation",{"property-access":{pattern:t(/(\.\s*)#?/.source),lookbehind:!0},"maybe-class-name":{pattern:/(^|[^$\w\xA0-\uFFFF])[A-Z][$\w\xA0-\uFFFF]+/,lookbehind:!0},dom:{pattern:/\b(?:document|(?:local|session)Storage|location|navigator|performance|window)\b/,alias:"variable"},console:{pattern:/\bconsole(?=\s*\.)/,alias:"class-name"}});for(var n=["function","function-variable","method","method-variable","property-access"],r=0;r*\.{3}(?:[^{}]|)*\})/.source;function o(e,t){return e=e.replace(//g,(function(){return n})).replace(//g,(function(){return r})).replace(//g,(function(){return a})),RegExp(e,t)}a=o(a).source,e.languages.jsx=e.languages.extend("markup",t),e.languages.jsx.tag.pattern=o(/<\/?(?:[\w.:-]+(?:+(?:[\w.:$-]+(?:=(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s{'"/>=]+|))?|))**\/?)?>/.source),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside["attr-value"].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside["class-name"]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore("inside","attr-name",{spread:{pattern:o(//.source),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore("inside","special-attr",{script:{pattern:o(/=/.source),alias:"language-javascript",inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:"punctuation"},rest:e.languages.jsx}}},e.languages.jsx.tag);var i=function(e){return e?"string"==typeof e?e:"string"==typeof e.content?e.content:e.content.map(i).join(""):""},l=function(t){for(var n=[],r=0;r0&&n[n.length-1].tagName===i(a.content[0].content[1])&&n.pop():"/>"===a.content[a.content.length-1].content||n.push({tagName:i(a.content[0].content[1]),openedBraces:0}):n.length>0&&"punctuation"===a.type&&"{"===a.content?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&"punctuation"===a.type&&"}"===a.content?n[n.length-1].openedBraces--:o=!0),(o||"string"==typeof a)&&n.length>0&&0===n[n.length-1].openedBraces){var s=i(a);r0&&("string"==typeof t[r-1]||"plain-text"===t[r-1].type)&&(s=i(t[r-1])+s,t.splice(r-1,1),r--),t[r]=new e.Token("plain-text",s,null,s)}a.content&&"string"!=typeof a.content&&l(a.content)}};e.hooks.add("after-tokenize",(function(e){"jsx"!==e.language&&"tsx"!==e.language||l(e.tokens)}))}(a),function(e){e.languages.diff={coord:[/^(?:\*{3}|-{3}|\+{3}).*$/m,/^@@.*@@$/m,/^\d.*$/m]};var t={"deleted-sign":"-","deleted-arrow":"<","inserted-sign":"+","inserted-arrow":">",unchanged:" ",diff:"!"};Object.keys(t).forEach((function(n){var r=t[n],a=[];/^\w+$/.test(n)||a.push(/\w+/.exec(n)[0]),"diff"===n&&a.push("bold"),e.languages.diff[n]={pattern:RegExp("^(?:["+r+"].*(?:\r\n?|\n|(?![\\s\\S])))+","m"),alias:a,inside:{line:{pattern:/(.)(?=[\s\S]).*(?:\r\n?|\n)?/,lookbehind:!0},prefix:{pattern:/[\s\S]/,alias:/\w+/.exec(n)[0]}}}})),Object.defineProperty(e.languages.diff,"PREFIXES",{value:t})}(a),a.languages.git={comment:/^#.*/m,deleted:/^[-\u2013].*/m,inserted:/^\+.*/m,string:/("|')(?:\\.|(?!\1)[^\\\r\n])*\1/,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s--?\w+/}},coord:/^@@.*@@$/m,"commit-sha1":/^commit \w{40}$/m},a.languages.go=a.languages.extend("clike",{string:{pattern:/(^|[^\\])"(?:\\.|[^"\\\r\n])*"|`[^`]*`/,lookbehind:!0,greedy:!0},keyword:/\b(?:break|case|chan|const|continue|default|defer|else|fallthrough|for|func|go(?:to)?|if|import|interface|map|package|range|return|select|struct|switch|type|var)\b/,boolean:/\b(?:_|false|iota|nil|true)\b/,number:[/\b0(?:b[01_]+|o[0-7_]+)i?\b/i,/\b0x(?:[a-f\d_]+(?:\.[a-f\d_]*)?|\.[a-f\d_]+)(?:p[+-]?\d+(?:_\d+)*)?i?(?!\w)/i,/(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.\d[\d_]*)(?:e[+-]?[\d_]+)?i?(?!\w)/i],operator:/[*\/%^!=]=?|\+[=+]?|-[=-]?|\|[=|]?|&(?:=|&|\^=?)?|>(?:>=?|=)?|<(?:<=?|=|-)?|:=|\.\.\./,builtin:/\b(?:append|bool|byte|cap|close|complex|complex(?:64|128)|copy|delete|error|float(?:32|64)|u?int(?:8|16|32|64)?|imag|len|make|new|panic|print(?:ln)?|real|recover|rune|string|uintptr)\b/}),a.languages.insertBefore("go","string",{char:{pattern:/'(?:\\.|[^'\\\r\n]){0,10}'/,greedy:!0}}),delete a.languages.go["class-name"],function(e){function t(e,t){return"___"+e.toUpperCase()+t+"___"}Object.defineProperties(e.languages["markup-templating"]={},{buildPlaceholders:{value:function(n,r,a,o){if(n.language===r){var i=n.tokenStack=[];n.code=n.code.replace(a,(function(e){if("function"==typeof o&&!o(e))return e;for(var a,l=i.length;-1!==n.code.indexOf(a=t(r,l));)++l;return i[l]=e,a})),n.grammar=e.languages.markup}}},tokenizePlaceholders:{value:function(n,r){if(n.language===r&&n.tokenStack){n.grammar=e.languages[r];var a=0,o=Object.keys(n.tokenStack);!function i(l){for(var s=0;s=o.length);s++){var c=l[s];if("string"==typeof c||c.content&&"string"==typeof c.content){var u=o[a],d=n.tokenStack[u],p="string"==typeof c?c:c.content,f=t(r,u),m=p.indexOf(f);if(m>-1){++a;var h=p.substring(0,m),g=new e.Token(r,e.tokenize(d,n.grammar),"language-"+r,d),b=p.substring(m+f.length),v=[];h&&v.push.apply(v,i([h])),v.push(g),b&&v.push.apply(v,i([b])),"string"==typeof c?l.splice.apply(l,[s,1].concat(v)):c.content=v}}else c.content&&i(c.content)}return l}(n.tokens)}}}})}(a),function(e){e.languages.handlebars={comment:/\{\{![\s\S]*?\}\}/,delimiter:{pattern:/^\{\{\{?|\}\}\}?$/,alias:"punctuation"},string:/(["'])(?:\\.|(?!\1)[^\\\r\n])*\1/,number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee][+-]?\d+)?/,boolean:/\b(?:false|true)\b/,block:{pattern:/^(\s*(?:~\s*)?)[#\/]\S+?(?=\s*(?:~\s*)?$|\s)/,lookbehind:!0,alias:"keyword"},brackets:{pattern:/\[[^\]]+\]/,inside:{punctuation:/\[|\]/,variable:/[\s\S]+/}},punctuation:/[!"#%&':()*+,.\/;<=>@\[\\\]^`{|}~]/,variable:/[^!"#%&'()*+,\/;<=>@\[\\\]^`{|}~\s]+/},e.hooks.add("before-tokenize",(function(t){e.languages["markup-templating"].buildPlaceholders(t,"handlebars",/\{\{\{[\s\S]+?\}\}\}|\{\{[\s\S]+?\}\}/g)})),e.hooks.add("after-tokenize",(function(t){e.languages["markup-templating"].tokenizePlaceholders(t,"handlebars")})),e.languages.hbs=e.languages.handlebars}(a),a.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"}},a.languages.webmanifest=a.languages.json,a.languages.less=a.languages.extend("css",{comment:[/\/\*[\s\S]*?\*\//,{pattern:/(^|[^\\])\/\/.*/,lookbehind:!0}],atrule:{pattern:/@[\w-](?:\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{punctuation:/[:()]/}},selector:{pattern:/(?:@\{[\w-]+\}|[^{};\s@])(?:@\{[\w-]+\}|\((?:[^(){}]|\([^(){}]*\))*\)|[^(){};@\s]|\s+(?!\s))*?(?=\s*\{)/,inside:{variable:/@+[\w-]+/}},property:/(?:@\{[\w-]+\}|[\w-])+(?:\+_?)?(?=\s*:)/,operator:/[+\-*\/]/}),a.languages.insertBefore("less","property",{variable:[{pattern:/@[\w-]+\s*:/,inside:{punctuation:/:/}},/@@?[\w-]+/],"mixin-usage":{pattern:/([{;]\s*)[.#](?!\d)[\w-].*?(?=[(;])/,lookbehind:!0,alias:"function"}}),a.languages.makefile={comment:{pattern:/(^|[^\\])#(?:\\(?:\r\n|[\s\S])|[^\\\r\n])*/,lookbehind:!0},string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"builtin-target":{pattern:/\.[A-Z][^:#=\s]+(?=\s*:(?!=))/,alias:"builtin"},target:{pattern:/^(?:[^:=\s]|[ \t]+(?![\s:]))+(?=\s*:(?!=))/m,alias:"symbol",inside:{variable:/\$+(?:(?!\$)[^(){}:#=\s]+|(?=[({]))/}},variable:/\$+(?:(?!\$)[^(){}:#=\s]+|\([@*%<^+?][DF]\)|(?=[({]))/,keyword:/-include\b|\b(?:define|else|endef|endif|export|ifn?def|ifn?eq|include|override|private|sinclude|undefine|unexport|vpath)\b/,function:{pattern:/(\()(?:abspath|addsuffix|and|basename|call|dir|error|eval|file|filter(?:-out)?|findstring|firstword|flavor|foreach|guile|if|info|join|lastword|load|notdir|or|origin|patsubst|realpath|shell|sort|strip|subst|suffix|value|warning|wildcard|word(?:list|s)?)(?=[ \t])/,lookbehind:!0},operator:/(?:::|[?:+!])?=|[|@]/,punctuation:/[:;(){}]/},a.languages.objectivec=a.languages.extend("c",{string:{pattern:/@?"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"/,greedy:!0},keyword:/\b(?:asm|auto|break|case|char|const|continue|default|do|double|else|enum|extern|float|for|goto|if|in|inline|int|long|register|return|self|short|signed|sizeof|static|struct|super|switch|typedef|typeof|union|unsigned|void|volatile|while)\b|(?:@interface|@end|@implementation|@protocol|@class|@public|@protected|@private|@property|@try|@catch|@finally|@throw|@synthesize|@dynamic|@selector)\b/,operator:/-[->]?|\+\+?|!=?|<>?=?|==?|&&?|\|\|?|[~^%?*\/@]/}),delete a.languages.objectivec["class-name"],a.languages.objc=a.languages.objectivec,a.languages.ocaml={comment:{pattern:/\(\*[\s\S]*?\*\)/,greedy:!0},char:{pattern:/'(?:[^\\\r\n']|\\(?:.|[ox]?[0-9a-f]{1,3}))'/i,greedy:!0},string:[{pattern:/"(?:\\(?:[\s\S]|\r\n)|[^\\\r\n"])*"/,greedy:!0},{pattern:/\{([a-z_]*)\|[\s\S]*?\|\1\}/,greedy:!0}],number:[/\b(?:0b[01][01_]*|0o[0-7][0-7_]*)\b/i,/\b0x[a-f0-9][a-f0-9_]*(?:\.[a-f0-9_]*)?(?:p[+-]?\d[\d_]*)?(?!\w)/i,/\b\d[\d_]*(?:\.[\d_]*)?(?:e[+-]?\d[\d_]*)?(?!\w)/i],directive:{pattern:/\B#\w+/,alias:"property"},label:{pattern:/\B~\w+/,alias:"property"},"type-variable":{pattern:/\B'\w+/,alias:"function"},variant:{pattern:/`\w+/,alias:"symbol"},keyword:/\b(?:as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|match|method|module|mutable|new|nonrec|object|of|open|private|rec|sig|struct|then|to|try|type|val|value|virtual|when|where|while|with)\b/,boolean:/\b(?:false|true)\b/,"operator-like-punctuation":{pattern:/\[[<>|]|[>|]\]|\{<|>\}/,alias:"punctuation"},operator:/\.[.~]|:[=>]|[=<>@^|&+\-*\/$%!?~][!$%&*+\-.\/:<=>?@^|~]*|\b(?:and|asr|land|lor|lsl|lsr|lxor|mod|or)\b/,punctuation:/;;|::|[(){}\[\].,:;#]|\b_\b/},a.languages.python={comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0,greedy:!0},"string-interpolation":{pattern:/(?:f|fr|rf)(?:("""|''')[\s\S]*?\1|("|')(?:\\.|(?!\2)[^\\\r\n])*\2)/i,greedy:!0,inside:{interpolation:{pattern:/((?:^|[^{])(?:\{\{)*)\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}]|\{(?!\{)(?:[^{}])+\})+\})+\}/,lookbehind:!0,inside:{"format-spec":{pattern:/(:)[^:(){}]+(?=\}$)/,lookbehind:!0},"conversion-option":{pattern:/![sra](?=[:}]$)/,alias:"punctuation"},rest:null}},string:/[\s\S]+/}},"triple-quoted-string":{pattern:/(?:[rub]|br|rb)?("""|''')[\s\S]*?\1/i,greedy:!0,alias:"string"},string:{pattern:/(?:[rub]|br|rb)?("|')(?:\\.|(?!\1)[^\\\r\n])*\1/i,greedy:!0},function:{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_]\w*(?=\s*\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)\w+/i,lookbehind:!0},decorator:{pattern:/(^[\t ]*)@\w+(?:\.\w+)*/m,lookbehind:!0,alias:["annotation","punctuation"],inside:{punctuation:/\./}},keyword:/\b(?:_(?=\s*:)|and|as|assert|async|await|break|case|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|match|nonlocal|not|or|pass|print|raise|return|try|while|with|yield)\b/,builtin:/\b(?:__import__|abs|all|any|apply|ascii|basestring|bin|bool|buffer|bytearray|bytes|callable|chr|classmethod|cmp|coerce|compile|complex|delattr|dict|dir|divmod|enumerate|eval|execfile|file|filter|float|format|frozenset|getattr|globals|hasattr|hash|help|hex|id|input|int|intern|isinstance|issubclass|iter|len|list|locals|long|map|max|memoryview|min|next|object|oct|open|ord|pow|property|range|raw_input|reduce|reload|repr|reversed|round|set|setattr|slice|sorted|staticmethod|str|sum|super|tuple|type|unichr|unicode|vars|xrange|zip)\b/,boolean:/\b(?:False|None|True)\b/,number:/\b0(?:b(?:_?[01])+|o(?:_?[0-7])+|x(?:_?[a-f0-9])+)\b|(?:\b\d+(?:_\d+)*(?:\.(?:\d+(?:_\d+)*)?)?|\B\.\d+(?:_\d+)*)(?:e[+-]?\d+(?:_\d+)*)?j?(?!\w)/i,operator:/[-+%=]=?|!=|:=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]/,punctuation:/[{}[\];(),.:]/},a.languages.python["string-interpolation"].inside.interpolation.inside.rest=a.languages.python,a.languages.py=a.languages.python,a.languages.reason=a.languages.extend("clike",{string:{pattern:/"(?:\\(?:\r\n|[\s\S])|[^\\\r\n"])*"/,greedy:!0},"class-name":/\b[A-Z]\w*/,keyword:/\b(?:and|as|assert|begin|class|constraint|do|done|downto|else|end|exception|external|for|fun|function|functor|if|in|include|inherit|initializer|lazy|let|method|module|mutable|new|nonrec|object|of|open|or|private|rec|sig|struct|switch|then|to|try|type|val|virtual|when|while|with)\b/,operator:/\.{3}|:[:=]|\|>|->|=(?:==?|>)?|<=?|>=?|[|^?'#!~`]|[+\-*\/]\.?|\b(?:asr|land|lor|lsl|lsr|lxor|mod)\b/}),a.languages.insertBefore("reason","class-name",{char:{pattern:/'(?:\\x[\da-f]{2}|\\o[0-3][0-7][0-7]|\\\d{3}|\\.|[^'\\\r\n])'/,greedy:!0},constructor:/\b[A-Z]\w*\b(?!\s*\.)/,label:{pattern:/\b[a-z]\w*(?=::)/,alias:"symbol"}}),delete a.languages.reason.function,function(e){e.languages.sass=e.languages.extend("css",{comment:{pattern:/^([ \t]*)\/[\/*].*(?:(?:\r?\n|\r)\1[ \t].+)*/m,lookbehind:!0,greedy:!0}}),e.languages.insertBefore("sass","atrule",{"atrule-line":{pattern:/^(?:[ \t]*)[@+=].+/m,greedy:!0,inside:{atrule:/(?:@[\w-]+|[+=])/}}}),delete e.languages.sass.atrule;var t=/\$[-\w]+|#\{\$[-\w]+\}/,n=[/[+*\/%]|[=!]=|<=?|>=?|\b(?:and|not|or)\b/,{pattern:/(\s)-(?=\s)/,lookbehind:!0}];e.languages.insertBefore("sass","property",{"variable-line":{pattern:/^[ \t]*\$.+/m,greedy:!0,inside:{punctuation:/:/,variable:t,operator:n}},"property-line":{pattern:/^[ \t]*(?:[^:\s]+ *:.*|:[^:\s].*)/m,greedy:!0,inside:{property:[/[^:\s]+(?=\s*:)/,{pattern:/(:)[^:\s]+/,lookbehind:!0}],punctuation:/:/,variable:t,operator:n,important:e.languages.sass.important}}}),delete e.languages.sass.property,delete e.languages.sass.important,e.languages.insertBefore("sass","punctuation",{selector:{pattern:/^([ \t]*)\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*(?:,(?:\r?\n|\r)\1[ \t]+\S(?:,[^,\r\n]+|[^,\r\n]*)(?:,[^,\r\n]+)*)*/m,lookbehind:!0,greedy:!0}})}(a),a.languages.scss=a.languages.extend("css",{comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},atrule:{pattern:/@[\w-](?:\([^()]+\)|[^()\s]|\s+(?!\s))*?(?=\s+[{;])/,inside:{rule:/@[\w-]+/}},url:/(?:[-a-z]+-)?url(?=\()/i,selector:{pattern:/(?=\S)[^@;{}()]?(?:[^@;{}()\s]|\s+(?!\s)|#\{\$[-\w]+\})+(?=\s*\{(?:\}|\s|[^}][^:{}]*[:{][^}]))/,inside:{parent:{pattern:/&/,alias:"important"},placeholder:/%[-\w]+/,variable:/\$[-\w]+|#\{\$[-\w]+\}/}},property:{pattern:/(?:[-\w]|\$[-\w]|#\{\$[-\w]+\})+(?=\s*:)/,inside:{variable:/\$[-\w]+|#\{\$[-\w]+\}/}}}),a.languages.insertBefore("scss","atrule",{keyword:[/@(?:content|debug|each|else(?: if)?|extend|for|forward|function|if|import|include|mixin|return|use|warn|while)\b/i,{pattern:/( )(?:from|through)(?= )/,lookbehind:!0}]}),a.languages.insertBefore("scss","important",{variable:/\$[-\w]+|#\{\$[-\w]+\}/}),a.languages.insertBefore("scss","function",{"module-modifier":{pattern:/\b(?:as|hide|show|with)\b/i,alias:"keyword"},placeholder:{pattern:/%[-\w]+/,alias:"selector"},statement:{pattern:/\B!(?:default|optional)\b/i,alias:"keyword"},boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:"keyword"},operator:{pattern:/(\s)(?:[-+*\/%]|[=!]=|<=?|>=?|and|not|or)(?=\s)/,lookbehind:!0}}),a.languages.scss.atrule.inside.rest=a.languages.scss,function(e){var t={pattern:/(\b\d+)(?:%|[a-z]+)/,lookbehind:!0},n={pattern:/(^|[^\w.-])-?(?:\d+(?:\.\d+)?|\.\d+)/,lookbehind:!0},r={comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0},url:{pattern:/\burl\((["']?).*?\1\)/i,greedy:!0},string:{pattern:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,greedy:!0},interpolation:null,func:null,important:/\B!(?:important|optional)\b/i,keyword:{pattern:/(^|\s+)(?:(?:else|for|if|return|unless)(?=\s|$)|@[\w-]+)/,lookbehind:!0},hexcode:/#[\da-f]{3,6}/i,color:[/\b(?:AliceBlue|AntiqueWhite|Aqua|Aquamarine|Azure|Beige|Bisque|Black|BlanchedAlmond|Blue|BlueViolet|Brown|BurlyWood|CadetBlue|Chartreuse|Chocolate|Coral|CornflowerBlue|Cornsilk|Crimson|Cyan|DarkBlue|DarkCyan|DarkGoldenRod|DarkGr[ae]y|DarkGreen|DarkKhaki|DarkMagenta|DarkOliveGreen|DarkOrange|DarkOrchid|DarkRed|DarkSalmon|DarkSeaGreen|DarkSlateBlue|DarkSlateGr[ae]y|DarkTurquoise|DarkViolet|DeepPink|DeepSkyBlue|DimGr[ae]y|DodgerBlue|FireBrick|FloralWhite|ForestGreen|Fuchsia|Gainsboro|GhostWhite|Gold|GoldenRod|Gr[ae]y|Green|GreenYellow|HoneyDew|HotPink|IndianRed|Indigo|Ivory|Khaki|Lavender|LavenderBlush|LawnGreen|LemonChiffon|LightBlue|LightCoral|LightCyan|LightGoldenRodYellow|LightGr[ae]y|LightGreen|LightPink|LightSalmon|LightSeaGreen|LightSkyBlue|LightSlateGr[ae]y|LightSteelBlue|LightYellow|Lime|LimeGreen|Linen|Magenta|Maroon|MediumAquaMarine|MediumBlue|MediumOrchid|MediumPurple|MediumSeaGreen|MediumSlateBlue|MediumSpringGreen|MediumTurquoise|MediumVioletRed|MidnightBlue|MintCream|MistyRose|Moccasin|NavajoWhite|Navy|OldLace|Olive|OliveDrab|Orange|OrangeRed|Orchid|PaleGoldenRod|PaleGreen|PaleTurquoise|PaleVioletRed|PapayaWhip|PeachPuff|Peru|Pink|Plum|PowderBlue|Purple|Red|RosyBrown|RoyalBlue|SaddleBrown|Salmon|SandyBrown|SeaGreen|SeaShell|Sienna|Silver|SkyBlue|SlateBlue|SlateGr[ae]y|Snow|SpringGreen|SteelBlue|Tan|Teal|Thistle|Tomato|Transparent|Turquoise|Violet|Wheat|White|WhiteSmoke|Yellow|YellowGreen)\b/i,{pattern:/\b(?:hsl|rgb)\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*\)\B|\b(?:hsl|rgb)a\(\s*\d{1,3}\s*,\s*\d{1,3}%?\s*,\s*\d{1,3}%?\s*,\s*(?:0|0?\.\d+|1)\s*\)\B/i,inside:{unit:t,number:n,function:/[\w-]+(?=\()/,punctuation:/[(),]/}}],entity:/\\[\da-f]{1,8}/i,unit:t,boolean:/\b(?:false|true)\b/,operator:[/~|[+!\/%<>?=]=?|[-:]=|\*[*=]?|\.{2,3}|&&|\|\||\B-\B|\b(?:and|in|is(?: a| defined| not|nt)?|not|or)\b/],number:n,punctuation:/[{}()\[\];:,]/};r.interpolation={pattern:/\{[^\r\n}:]+\}/,alias:"variable",inside:{delimiter:{pattern:/^\{|\}$/,alias:"punctuation"},rest:r}},r.func={pattern:/[\w-]+\([^)]*\).*/,inside:{function:/^[^(]+/,rest:r}},e.languages.stylus={"atrule-declaration":{pattern:/(^[ \t]*)@.+/m,lookbehind:!0,inside:{atrule:/^@[\w-]+/,rest:r}},"variable-declaration":{pattern:/(^[ \t]*)[\w$-]+\s*.?=[ \t]*(?:\{[^{}]*\}|\S.*|$)/m,lookbehind:!0,inside:{variable:/^\S+/,rest:r}},statement:{pattern:/(^[ \t]*)(?:else|for|if|return|unless)[ \t].+/m,lookbehind:!0,inside:{keyword:/^\S+/,rest:r}},"property-declaration":{pattern:/((?:^|\{)([ \t]*))(?:[\w-]|\{[^}\r\n]+\})+(?:\s*:\s*|[ \t]+)(?!\s)[^{\r\n]*(?:;|[^{\r\n,]$(?!(?:\r?\n|\r)(?:\{|\2[ \t])))/m,lookbehind:!0,inside:{property:{pattern:/^[^\s:]+/,inside:{interpolation:r.interpolation}},rest:r}},selector:{pattern:/(^[ \t]*)(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)(?:(?:\r?\n|\r)(?:\1(?:(?=\S)(?:[^{}\r\n:()]|::?[\w-]+(?:\([^)\r\n]*\)|(?![\w-]))|\{[^}\r\n]+\})+)))*(?:,$|\{|(?=(?:\r?\n|\r)(?:\{|\1[ \t])))/m,lookbehind:!0,inside:{interpolation:r.interpolation,comment:r.comment,punctuation:/[{},]/}},func:r.func,string:r.string,comment:{pattern:/(^|[^\\])(?:\/\*[\s\S]*?\*\/|\/\/.*)/,lookbehind:!0,greedy:!0},interpolation:r.interpolation,punctuation:/[{}()\[\];:.]/}}(a),function(e){var t=e.util.clone(e.languages.typescript);e.languages.tsx=e.languages.extend("jsx",t),delete e.languages.tsx.parameter,delete e.languages.tsx["literal-property"];var n=e.languages.tsx.tag;n.pattern=RegExp(/(^|[^\w$]|(?=<\/))/.source+"(?:"+n.pattern.source+")",n.pattern.flags),n.lookbehind=!0}(a),a.languages.wasm={comment:[/\(;[\s\S]*?;\)/,{pattern:/;;.*/,greedy:!0}],string:{pattern:/"(?:\\[\s\S]|[^"\\])*"/,greedy:!0},keyword:[{pattern:/\b(?:align|offset)=/,inside:{operator:/=/}},{pattern:/\b(?:(?:f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|neg?|nearest|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|sqrt|store(?:8|16|32)?|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))?|memory\.(?:grow|size))\b/,inside:{punctuation:/\./}},/\b(?:anyfunc|block|br(?:_if|_table)?|call(?:_indirect)?|data|drop|elem|else|end|export|func|get_(?:global|local)|global|if|import|local|loop|memory|module|mut|nop|offset|param|result|return|select|set_(?:global|local)|start|table|tee_local|then|type|unreachable)\b/],variable:/\$[\w!#$%&'*+\-./:<=>?@\\^`|~]+/,number:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/,punctuation:/[()]/};const o=a},9901:e=>{e.exports&&(e.exports={core:{meta:{path:"components/prism-core.js",option:"mandatory"},core:"Core"},themes:{meta:{path:"themes/{id}.css",link:"index.html?theme={id}",exclusive:!0},prism:{title:"Default",option:"default"},"prism-dark":"Dark","prism-funky":"Funky","prism-okaidia":{title:"Okaidia",owner:"ocodia"},"prism-twilight":{title:"Twilight",owner:"remybach"},"prism-coy":{title:"Coy",owner:"tshedor"},"prism-solarizedlight":{title:"Solarized Light",owner:"hectormatos2011 "},"prism-tomorrow":{title:"Tomorrow Night",owner:"Rosey"}},languages:{meta:{path:"components/prism-{id}",noCSS:!0,examplesPath:"examples/prism-{id}",addCheckAll:!0},markup:{title:"Markup",alias:["html","xml","svg","mathml","ssml","atom","rss"],aliasTitles:{html:"HTML",xml:"XML",svg:"SVG",mathml:"MathML",ssml:"SSML",atom:"Atom",rss:"RSS"},option:"default"},css:{title:"CSS",option:"default",modify:"markup"},clike:{title:"C-like",option:"default"},javascript:{title:"JavaScript",require:"clike",modify:"markup",optional:"regex",alias:"js",option:"default"},abap:{title:"ABAP",owner:"dellagustin"},abnf:{title:"ABNF",owner:"RunDevelopment"},actionscript:{title:"ActionScript",require:"javascript",modify:"markup",owner:"Golmote"},ada:{title:"Ada",owner:"Lucretia"},agda:{title:"Agda",owner:"xy-ren"},al:{title:"AL",owner:"RunDevelopment"},antlr4:{title:"ANTLR4",alias:"g4",owner:"RunDevelopment"},apacheconf:{title:"Apache Configuration",owner:"GuiTeK"},apex:{title:"Apex",require:["clike","sql"],owner:"RunDevelopment"},apl:{title:"APL",owner:"ngn"},applescript:{title:"AppleScript",owner:"Golmote"},aql:{title:"AQL",owner:"RunDevelopment"},arduino:{title:"Arduino",require:"cpp",alias:"ino",owner:"dkern"},arff:{title:"ARFF",owner:"Golmote"},armasm:{title:"ARM Assembly",alias:"arm-asm",owner:"RunDevelopment"},arturo:{title:"Arturo",alias:"art",optional:["bash","css","javascript","markup","markdown","sql"],owner:"drkameleon"},asciidoc:{alias:"adoc",title:"AsciiDoc",owner:"Golmote"},aspnet:{title:"ASP.NET (C#)",require:["markup","csharp"],owner:"nauzilus"},asm6502:{title:"6502 Assembly",owner:"kzurawel"},asmatmel:{title:"Atmel AVR Assembly",owner:"cerkit"},autohotkey:{title:"AutoHotkey",owner:"aviaryan"},autoit:{title:"AutoIt",owner:"Golmote"},avisynth:{title:"AviSynth",alias:"avs",owner:"Zinfidel"},"avro-idl":{title:"Avro IDL",alias:"avdl",owner:"RunDevelopment"},awk:{title:"AWK",alias:"gawk",aliasTitles:{gawk:"GAWK"},owner:"RunDevelopment"},bash:{title:"Bash",alias:["sh","shell"],aliasTitles:{sh:"Shell",shell:"Shell"},owner:"zeitgeist87"},basic:{title:"BASIC",owner:"Golmote"},batch:{title:"Batch",owner:"Golmote"},bbcode:{title:"BBcode",alias:"shortcode",aliasTitles:{shortcode:"Shortcode"},owner:"RunDevelopment"},bbj:{title:"BBj",owner:"hyyan"},bicep:{title:"Bicep",owner:"johnnyreilly"},birb:{title:"Birb",require:"clike",owner:"Calamity210"},bison:{title:"Bison",require:"c",owner:"Golmote"},bnf:{title:"BNF",alias:"rbnf",aliasTitles:{rbnf:"RBNF"},owner:"RunDevelopment"},bqn:{title:"BQN",owner:"yewscion"},brainfuck:{title:"Brainfuck",owner:"Golmote"},brightscript:{title:"BrightScript",owner:"RunDevelopment"},bro:{title:"Bro",owner:"wayward710"},bsl:{title:"BSL (1C:Enterprise)",alias:"oscript",aliasTitles:{oscript:"OneScript"},owner:"Diversus23"},c:{title:"C",require:"clike",owner:"zeitgeist87"},csharp:{title:"C#",require:"clike",alias:["cs","dotnet"],owner:"mvalipour"},cpp:{title:"C++",require:"c",owner:"zeitgeist87"},cfscript:{title:"CFScript",require:"clike",alias:"cfc",owner:"mjclemente"},chaiscript:{title:"ChaiScript",require:["clike","cpp"],owner:"RunDevelopment"},cil:{title:"CIL",owner:"sbrl"},cilkc:{title:"Cilk/C",require:"c",alias:"cilk-c",owner:"OpenCilk"},cilkcpp:{title:"Cilk/C++",require:"cpp",alias:["cilk-cpp","cilk"],owner:"OpenCilk"},clojure:{title:"Clojure",owner:"troglotit"},cmake:{title:"CMake",owner:"mjrogozinski"},cobol:{title:"COBOL",owner:"RunDevelopment"},coffeescript:{title:"CoffeeScript",require:"javascript",alias:"coffee",owner:"R-osey"},concurnas:{title:"Concurnas",alias:"conc",owner:"jasontatton"},csp:{title:"Content-Security-Policy",owner:"ScottHelme"},cooklang:{title:"Cooklang",owner:"ahue"},coq:{title:"Coq",owner:"RunDevelopment"},crystal:{title:"Crystal",require:"ruby",owner:"MakeNowJust"},"css-extras":{title:"CSS Extras",require:"css",modify:"css",owner:"milesj"},csv:{title:"CSV",owner:"RunDevelopment"},cue:{title:"CUE",owner:"RunDevelopment"},cypher:{title:"Cypher",owner:"RunDevelopment"},d:{title:"D",require:"clike",owner:"Golmote"},dart:{title:"Dart",require:"clike",owner:"Golmote"},dataweave:{title:"DataWeave",owner:"machaval"},dax:{title:"DAX",owner:"peterbud"},dhall:{title:"Dhall",owner:"RunDevelopment"},diff:{title:"Diff",owner:"uranusjr"},django:{title:"Django/Jinja2",require:"markup-templating",alias:"jinja2",owner:"romanvm"},"dns-zone-file":{title:"DNS zone file",owner:"RunDevelopment",alias:"dns-zone"},docker:{title:"Docker",alias:"dockerfile",owner:"JustinBeckwith"},dot:{title:"DOT (Graphviz)",alias:"gv",optional:"markup",owner:"RunDevelopment"},ebnf:{title:"EBNF",owner:"RunDevelopment"},editorconfig:{title:"EditorConfig",owner:"osipxd"},eiffel:{title:"Eiffel",owner:"Conaclos"},ejs:{title:"EJS",require:["javascript","markup-templating"],owner:"RunDevelopment",alias:"eta",aliasTitles:{eta:"Eta"}},elixir:{title:"Elixir",owner:"Golmote"},elm:{title:"Elm",owner:"zwilias"},etlua:{title:"Embedded Lua templating",require:["lua","markup-templating"],owner:"RunDevelopment"},erb:{title:"ERB",require:["ruby","markup-templating"],owner:"Golmote"},erlang:{title:"Erlang",owner:"Golmote"},"excel-formula":{title:"Excel Formula",alias:["xlsx","xls"],owner:"RunDevelopment"},fsharp:{title:"F#",require:"clike",owner:"simonreynolds7"},factor:{title:"Factor",owner:"catb0t"},false:{title:"False",owner:"edukisto"},"firestore-security-rules":{title:"Firestore security rules",require:"clike",owner:"RunDevelopment"},flow:{title:"Flow",require:"javascript",owner:"Golmote"},fortran:{title:"Fortran",owner:"Golmote"},ftl:{title:"FreeMarker Template Language",require:"markup-templating",owner:"RunDevelopment"},gml:{title:"GameMaker Language",alias:"gamemakerlanguage",require:"clike",owner:"LiarOnce"},gap:{title:"GAP (CAS)",owner:"RunDevelopment"},gcode:{title:"G-code",owner:"RunDevelopment"},gdscript:{title:"GDScript",owner:"RunDevelopment"},gedcom:{title:"GEDCOM",owner:"Golmote"},gettext:{title:"gettext",alias:"po",owner:"RunDevelopment"},gherkin:{title:"Gherkin",owner:"hason"},git:{title:"Git",owner:"lgiraudel"},glsl:{title:"GLSL",require:"c",owner:"Golmote"},gn:{title:"GN",alias:"gni",owner:"RunDevelopment"},"linker-script":{title:"GNU Linker Script",alias:"ld",owner:"RunDevelopment"},go:{title:"Go",require:"clike",owner:"arnehormann"},"go-module":{title:"Go module",alias:"go-mod",owner:"RunDevelopment"},gradle:{title:"Gradle",require:"clike",owner:"zeabdelkhalek-badido18"},graphql:{title:"GraphQL",optional:"markdown",owner:"Golmote"},groovy:{title:"Groovy",require:"clike",owner:"robfletcher"},haml:{title:"Haml",require:"ruby",optional:["css","css-extras","coffeescript","erb","javascript","less","markdown","scss","textile"],owner:"Golmote"},handlebars:{title:"Handlebars",require:"markup-templating",alias:["hbs","mustache"],aliasTitles:{mustache:"Mustache"},owner:"Golmote"},haskell:{title:"Haskell",alias:"hs",owner:"bholst"},haxe:{title:"Haxe",require:"clike",optional:"regex",owner:"Golmote"},hcl:{title:"HCL",owner:"outsideris"},hlsl:{title:"HLSL",require:"c",owner:"RunDevelopment"},hoon:{title:"Hoon",owner:"matildepark"},http:{title:"HTTP",optional:["csp","css","hpkp","hsts","javascript","json","markup","uri"],owner:"danielgtaylor"},hpkp:{title:"HTTP Public-Key-Pins",owner:"ScottHelme"},hsts:{title:"HTTP Strict-Transport-Security",owner:"ScottHelme"},ichigojam:{title:"IchigoJam",owner:"BlueCocoa"},icon:{title:"Icon",owner:"Golmote"},"icu-message-format":{title:"ICU Message Format",owner:"RunDevelopment"},idris:{title:"Idris",alias:"idr",owner:"KeenS",require:"haskell"},ignore:{title:".ignore",owner:"osipxd",alias:["gitignore","hgignore","npmignore"],aliasTitles:{gitignore:".gitignore",hgignore:".hgignore",npmignore:".npmignore"}},inform7:{title:"Inform 7",owner:"Golmote"},ini:{title:"Ini",owner:"aviaryan"},io:{title:"Io",owner:"AlesTsurko"},j:{title:"J",owner:"Golmote"},java:{title:"Java",require:"clike",owner:"sherblot"},javadoc:{title:"JavaDoc",require:["markup","java","javadoclike"],modify:"java",optional:"scala",owner:"RunDevelopment"},javadoclike:{title:"JavaDoc-like",modify:["java","javascript","php"],owner:"RunDevelopment"},javastacktrace:{title:"Java stack trace",owner:"RunDevelopment"},jexl:{title:"Jexl",owner:"czosel"},jolie:{title:"Jolie",require:"clike",owner:"thesave"},jq:{title:"JQ",owner:"RunDevelopment"},jsdoc:{title:"JSDoc",require:["javascript","javadoclike","typescript"],modify:"javascript",optional:["actionscript","coffeescript"],owner:"RunDevelopment"},"js-extras":{title:"JS Extras",require:"javascript",modify:"javascript",optional:["actionscript","coffeescript","flow","n4js","typescript"],owner:"RunDevelopment"},json:{title:"JSON",alias:"webmanifest",aliasTitles:{webmanifest:"Web App Manifest"},owner:"CupOfTea696"},json5:{title:"JSON5",require:"json",owner:"RunDevelopment"},jsonp:{title:"JSONP",require:"json",owner:"RunDevelopment"},jsstacktrace:{title:"JS stack trace",owner:"sbrl"},"js-templates":{title:"JS Templates",require:"javascript",modify:"javascript",optional:["css","css-extras","graphql","markdown","markup","sql"],owner:"RunDevelopment"},julia:{title:"Julia",owner:"cdagnino"},keepalived:{title:"Keepalived Configure",owner:"dev-itsheng"},keyman:{title:"Keyman",owner:"mcdurdin"},kotlin:{title:"Kotlin",alias:["kt","kts"],aliasTitles:{kts:"Kotlin Script"},require:"clike",owner:"Golmote"},kumir:{title:"KuMir (\u041a\u0443\u041c\u0438\u0440)",alias:"kum",owner:"edukisto"},kusto:{title:"Kusto",owner:"RunDevelopment"},latex:{title:"LaTeX",alias:["tex","context"],aliasTitles:{tex:"TeX",context:"ConTeXt"},owner:"japborst"},latte:{title:"Latte",require:["clike","markup-templating","php"],owner:"nette"},less:{title:"Less",require:"css",optional:"css-extras",owner:"Golmote"},lilypond:{title:"LilyPond",require:"scheme",alias:"ly",owner:"RunDevelopment"},liquid:{title:"Liquid",require:"markup-templating",owner:"cinhtau"},lisp:{title:"Lisp",alias:["emacs","elisp","emacs-lisp"],owner:"JuanCaicedo"},livescript:{title:"LiveScript",owner:"Golmote"},llvm:{title:"LLVM IR",owner:"porglezomp"},log:{title:"Log file",optional:"javastacktrace",owner:"RunDevelopment"},lolcode:{title:"LOLCODE",owner:"Golmote"},lua:{title:"Lua",owner:"Golmote"},magma:{title:"Magma (CAS)",owner:"RunDevelopment"},makefile:{title:"Makefile",owner:"Golmote"},markdown:{title:"Markdown",require:"markup",optional:"yaml",alias:"md",owner:"Golmote"},"markup-templating":{title:"Markup templating",require:"markup",owner:"Golmote"},mata:{title:"Mata",owner:"RunDevelopment"},matlab:{title:"MATLAB",owner:"Golmote"},maxscript:{title:"MAXScript",owner:"RunDevelopment"},mel:{title:"MEL",owner:"Golmote"},mermaid:{title:"Mermaid",owner:"RunDevelopment"},metafont:{title:"METAFONT",owner:"LaeriExNihilo"},mizar:{title:"Mizar",owner:"Golmote"},mongodb:{title:"MongoDB",owner:"airs0urce",require:"javascript"},monkey:{title:"Monkey",owner:"Golmote"},moonscript:{title:"MoonScript",alias:"moon",owner:"RunDevelopment"},n1ql:{title:"N1QL",owner:"TMWilds"},n4js:{title:"N4JS",require:"javascript",optional:"jsdoc",alias:"n4jsd",owner:"bsmith-n4"},"nand2tetris-hdl":{title:"Nand To Tetris HDL",owner:"stephanmax"},naniscript:{title:"Naninovel Script",owner:"Elringus",alias:"nani"},nasm:{title:"NASM",owner:"rbmj"},neon:{title:"NEON",owner:"nette"},nevod:{title:"Nevod",owner:"nezaboodka"},nginx:{title:"nginx",owner:"volado"},nim:{title:"Nim",owner:"Golmote"},nix:{title:"Nix",owner:"Golmote"},nsis:{title:"NSIS",owner:"idleberg"},objectivec:{title:"Objective-C",require:"c",alias:"objc",owner:"uranusjr"},ocaml:{title:"OCaml",owner:"Golmote"},odin:{title:"Odin",owner:"edukisto"},opencl:{title:"OpenCL",require:"c",modify:["c","cpp"],owner:"Milania1"},openqasm:{title:"OpenQasm",alias:"qasm",owner:"RunDevelopment"},oz:{title:"Oz",owner:"Golmote"},parigp:{title:"PARI/GP",owner:"Golmote"},parser:{title:"Parser",require:"markup",owner:"Golmote"},pascal:{title:"Pascal",alias:"objectpascal",aliasTitles:{objectpascal:"Object Pascal"},owner:"Golmote"},pascaligo:{title:"Pascaligo",owner:"DefinitelyNotAGoat"},psl:{title:"PATROL Scripting Language",owner:"bertysentry"},pcaxis:{title:"PC-Axis",alias:"px",owner:"RunDevelopment"},peoplecode:{title:"PeopleCode",alias:"pcode",owner:"RunDevelopment"},perl:{title:"Perl",owner:"Golmote"},php:{title:"PHP",require:"markup-templating",owner:"milesj"},phpdoc:{title:"PHPDoc",require:["php","javadoclike"],modify:"php",owner:"RunDevelopment"},"php-extras":{title:"PHP Extras",require:"php",modify:"php",owner:"milesj"},"plant-uml":{title:"PlantUML",alias:"plantuml",owner:"RunDevelopment"},plsql:{title:"PL/SQL",require:"sql",owner:"Golmote"},powerquery:{title:"PowerQuery",alias:["pq","mscript"],owner:"peterbud"},powershell:{title:"PowerShell",owner:"nauzilus"},processing:{title:"Processing",require:"clike",owner:"Golmote"},prolog:{title:"Prolog",owner:"Golmote"},promql:{title:"PromQL",owner:"arendjr"},properties:{title:".properties",owner:"Golmote"},protobuf:{title:"Protocol Buffers",require:"clike",owner:"just-boris"},pug:{title:"Pug",require:["markup","javascript"],optional:["coffeescript","ejs","handlebars","less","livescript","markdown","scss","stylus","twig"],owner:"Golmote"},puppet:{title:"Puppet",owner:"Golmote"},pure:{title:"Pure",optional:["c","cpp","fortran"],owner:"Golmote"},purebasic:{title:"PureBasic",require:"clike",alias:"pbfasm",owner:"HeX0R101"},purescript:{title:"PureScript",require:"haskell",alias:"purs",owner:"sriharshachilakapati"},python:{title:"Python",alias:"py",owner:"multipetros"},qsharp:{title:"Q#",require:"clike",alias:"qs",owner:"fedonman"},q:{title:"Q (kdb+ database)",owner:"Golmote"},qml:{title:"QML",require:"javascript",owner:"RunDevelopment"},qore:{title:"Qore",require:"clike",owner:"temnroegg"},r:{title:"R",owner:"Golmote"},racket:{title:"Racket",require:"scheme",alias:"rkt",owner:"RunDevelopment"},cshtml:{title:"Razor C#",alias:"razor",require:["markup","csharp"],optional:["css","css-extras","javascript","js-extras"],owner:"RunDevelopment"},jsx:{title:"React JSX",require:["markup","javascript"],optional:["jsdoc","js-extras","js-templates"],owner:"vkbansal"},tsx:{title:"React TSX",require:["jsx","typescript"]},reason:{title:"Reason",require:"clike",owner:"Golmote"},regex:{title:"Regex",owner:"RunDevelopment"},rego:{title:"Rego",owner:"JordanSh"},renpy:{title:"Ren'py",alias:"rpy",owner:"HyuchiaDiego"},rescript:{title:"ReScript",alias:"res",owner:"vmarcosp"},rest:{title:"reST (reStructuredText)",owner:"Golmote"},rip:{title:"Rip",owner:"ravinggenius"},roboconf:{title:"Roboconf",owner:"Golmote"},robotframework:{title:"Robot Framework",alias:"robot",owner:"RunDevelopment"},ruby:{title:"Ruby",require:"clike",alias:"rb",owner:"samflores"},rust:{title:"Rust",owner:"Golmote"},sas:{title:"SAS",optional:["groovy","lua","sql"],owner:"Golmote"},sass:{title:"Sass (Sass)",require:"css",optional:"css-extras",owner:"Golmote"},scss:{title:"Sass (SCSS)",require:"css",optional:"css-extras",owner:"MoOx"},scala:{title:"Scala",require:"java",owner:"jozic"},scheme:{title:"Scheme",owner:"bacchus123"},"shell-session":{title:"Shell session",require:"bash",alias:["sh-session","shellsession"],owner:"RunDevelopment"},smali:{title:"Smali",owner:"RunDevelopment"},smalltalk:{title:"Smalltalk",owner:"Golmote"},smarty:{title:"Smarty",require:"markup-templating",optional:"php",owner:"Golmote"},sml:{title:"SML",alias:"smlnj",aliasTitles:{smlnj:"SML/NJ"},owner:"RunDevelopment"},solidity:{title:"Solidity (Ethereum)",alias:"sol",require:"clike",owner:"glachaud"},"solution-file":{title:"Solution file",alias:"sln",owner:"RunDevelopment"},soy:{title:"Soy (Closure Template)",require:"markup-templating",owner:"Golmote"},sparql:{title:"SPARQL",require:"turtle",owner:"Triply-Dev",alias:"rq"},"splunk-spl":{title:"Splunk SPL",owner:"RunDevelopment"},sqf:{title:"SQF: Status Quo Function (Arma 3)",require:"clike",owner:"RunDevelopment"},sql:{title:"SQL",owner:"multipetros"},squirrel:{title:"Squirrel",require:"clike",owner:"RunDevelopment"},stan:{title:"Stan",owner:"RunDevelopment"},stata:{title:"Stata Ado",require:["mata","java","python"],owner:"RunDevelopment"},iecst:{title:"Structured Text (IEC 61131-3)",owner:"serhioromano"},stylus:{title:"Stylus",owner:"vkbansal"},supercollider:{title:"SuperCollider",alias:"sclang",owner:"RunDevelopment"},swift:{title:"Swift",owner:"chrischares"},systemd:{title:"Systemd configuration file",owner:"RunDevelopment"},"t4-templating":{title:"T4 templating",owner:"RunDevelopment"},"t4-cs":{title:"T4 Text Templates (C#)",require:["t4-templating","csharp"],alias:"t4",owner:"RunDevelopment"},"t4-vb":{title:"T4 Text Templates (VB)",require:["t4-templating","vbnet"],owner:"RunDevelopment"},tap:{title:"TAP",owner:"isaacs",require:"yaml"},tcl:{title:"Tcl",owner:"PeterChaplin"},tt2:{title:"Template Toolkit 2",require:["clike","markup-templating"],owner:"gflohr"},textile:{title:"Textile",require:"markup",optional:"css",owner:"Golmote"},toml:{title:"TOML",owner:"RunDevelopment"},tremor:{title:"Tremor",alias:["trickle","troy"],owner:"darach",aliasTitles:{trickle:"trickle",troy:"troy"}},turtle:{title:"Turtle",alias:"trig",aliasTitles:{trig:"TriG"},owner:"jakubklimek"},twig:{title:"Twig",require:"markup-templating",owner:"brandonkelly"},typescript:{title:"TypeScript",require:"javascript",optional:"js-templates",alias:"ts",owner:"vkbansal"},typoscript:{title:"TypoScript",alias:"tsconfig",aliasTitles:{tsconfig:"TSConfig"},owner:"dkern"},unrealscript:{title:"UnrealScript",alias:["uscript","uc"],owner:"RunDevelopment"},uorazor:{title:"UO Razor Script",owner:"jaseowns"},uri:{title:"URI",alias:"url",aliasTitles:{url:"URL"},owner:"RunDevelopment"},v:{title:"V",require:"clike",owner:"taggon"},vala:{title:"Vala",require:"clike",optional:"regex",owner:"TemplarVolk"},vbnet:{title:"VB.Net",require:"basic",owner:"Bigsby"},velocity:{title:"Velocity",require:"markup",owner:"Golmote"},verilog:{title:"Verilog",owner:"a-rey"},vhdl:{title:"VHDL",owner:"a-rey"},vim:{title:"vim",owner:"westonganger"},"visual-basic":{title:"Visual Basic",alias:["vb","vba"],aliasTitles:{vba:"VBA"},owner:"Golmote"},warpscript:{title:"WarpScript",owner:"RunDevelopment"},wasm:{title:"WebAssembly",owner:"Golmote"},"web-idl":{title:"Web IDL",alias:"webidl",owner:"RunDevelopment"},wgsl:{title:"WGSL",owner:"Dr4gonthree"},wiki:{title:"Wiki markup",require:"markup",owner:"Golmote"},wolfram:{title:"Wolfram language",alias:["mathematica","nb","wl"],aliasTitles:{mathematica:"Mathematica",nb:"Mathematica Notebook"},owner:"msollami"},wren:{title:"Wren",owner:"clsource"},xeora:{title:"Xeora",require:"markup",alias:"xeoracube",aliasTitles:{xeoracube:"XeoraCube"},owner:"freakmaxi"},"xml-doc":{title:"XML doc (.net)",require:"markup",modify:["csharp","fsharp","vbnet"],owner:"RunDevelopment"},xojo:{title:"Xojo (REALbasic)",owner:"Golmote"},xquery:{title:"XQuery",require:"markup",owner:"Golmote"},yaml:{title:"YAML",alias:"yml",owner:"hason"},yang:{title:"YANG",owner:"RunDevelopment"},zig:{title:"Zig",owner:"RunDevelopment"}},plugins:{meta:{path:"plugins/{id}/prism-{id}",link:"plugins/{id}/"},"line-highlight":{title:"Line Highlight",description:"Highlights specific lines and/or line ranges."},"line-numbers":{title:"Line Numbers",description:"Line number at the beginning of code lines.",owner:"kuba-kubula"},"show-invisibles":{title:"Show Invisibles",description:"Show hidden characters such as tabs and line breaks.",optional:["autolinker","data-uri-highlight"]},autolinker:{title:"Autolinker",description:"Converts URLs and emails in code to clickable links. Parses Markdown links in comments."},wpd:{title:"WebPlatform Docs",description:'Makes tokens link to WebPlatform.org documentation. The links open in a new tab.'},"custom-class":{title:"Custom Class",description:"This plugin allows you to prefix Prism's default classes (.comment can become .namespace--comment) or replace them with your defined ones (like .editor__comment). You can even add new classes.",owner:"dvkndn",noCSS:!0},"file-highlight":{title:"File Highlight",description:"Fetch external files and highlight them with Prism. Used on the Prism website itself.",noCSS:!0},"show-language":{title:"Show Language",description:"Display the highlighted language in code blocks (inline code does not show the label).",owner:"nauzilus",noCSS:!0,require:"toolbar"},"jsonp-highlight":{title:"JSONP Highlight",description:"Fetch content with JSONP and highlight some interesting content (e.g. GitHub/Gists or Bitbucket API).",noCSS:!0,owner:"nauzilus"},"highlight-keywords":{title:"Highlight Keywords",description:"Adds special CSS classes for each keyword for fine-grained highlighting.",owner:"vkbansal",noCSS:!0},"remove-initial-line-feed":{title:"Remove initial line feed",description:"Removes the initial line feed in code blocks.",owner:"Golmote",noCSS:!0},"inline-color":{title:"Inline color",description:"Adds a small inline preview for colors in style sheets.",require:"css-extras",owner:"RunDevelopment"},previewers:{title:"Previewers",description:"Previewers for angles, colors, gradients, easing and time.",require:"css-extras",owner:"Golmote"},autoloader:{title:"Autoloader",description:"Automatically loads the needed languages to highlight the code blocks.",owner:"Golmote",noCSS:!0},"keep-markup":{title:"Keep Markup",description:"Prevents custom markup from being dropped out during highlighting.",owner:"Golmote",optional:"normalize-whitespace",noCSS:!0},"command-line":{title:"Command Line",description:"Display a command line with a prompt and, optionally, the output/response from the commands.",owner:"chriswells0"},"unescaped-markup":{title:"Unescaped Markup",description:"Write markup without having to escape anything."},"normalize-whitespace":{title:"Normalize Whitespace",description:"Supports multiple operations to normalize whitespace in code blocks.",owner:"zeitgeist87",optional:"unescaped-markup",noCSS:!0},"data-uri-highlight":{title:"Data-URI Highlight",description:"Highlights data-URI contents.",owner:"Golmote",noCSS:!0},toolbar:{title:"Toolbar",description:"Attach a toolbar for plugins to easily register buttons on the top of a code block.",owner:"mAAdhaTTah"},"copy-to-clipboard":{title:"Copy to Clipboard Button",description:"Add a button that copies the code block to the clipboard when clicked.",owner:"mAAdhaTTah",require:"toolbar",noCSS:!0},"download-button":{title:"Download Button",description:"A button in the toolbar of a code block adding a convenient way to download a code file.",owner:"Golmote",require:"toolbar",noCSS:!0},"match-braces":{title:"Match braces",description:"Highlights matching braces.",owner:"RunDevelopment"},"diff-highlight":{title:"Diff Highlight",description:"Highlights the code inside diff blocks.",owner:"RunDevelopment",require:"diff"},"filter-highlight-all":{title:"Filter highlightAll",description:"Filters the elements the highlightAll and highlightAllUnder methods actually highlight.",owner:"RunDevelopment",noCSS:!0},treeview:{title:"Treeview",description:"A language with special styles to highlight file system tree structures.",owner:"Golmote"}}})},2885:(e,t,n)=>{const r=n(9901),a=n(9642),o=new Set;function i(e){void 0===e?e=Object.keys(r.languages).filter((e=>"meta"!=e)):Array.isArray(e)||(e=[e]);const t=[...o,...Object.keys(Prism.languages)];a(r,e,t).load((e=>{if(!(e in r.languages))return void(i.silent||console.warn("Language does not exist: "+e));const t="./prism-"+e;delete n.c[n(6500).resolve(t)],delete Prism.languages[e],n(6500)(t),o.add(e)}))}i.silent=!1,e.exports=i},6726:(e,t,n)=>{var r={"./":2885};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=6726},6500:(e,t,n)=>{var r={"./":2885};function a(e){var t=o(e);return n(t)}function o(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}a.keys=function(){return Object.keys(r)},a.resolve=o,e.exports=a,a.id=6500},9642:e=>{"use strict";var t=function(){var e=function(){};function t(e,t){Array.isArray(e)?e.forEach(t):null!=e&&t(e,0)}function n(e){for(var t={},n=0,r=e.length;n "));var l={},s=e[r];if(s){function c(t){if(!(t in e))throw new Error(r+" depends on an unknown component "+t);if(!(t in l))for(var i in a(t,o),l[t]=!0,n[t])l[i]=!0}t(s.require,c),t(s.optional,c),t(s.modify,c)}n[r]=l,o.pop()}}return function(e){var t=n[e];return t||(a(e,r),t=n[e]),t}}function a(e){for(var t in e)return!0;return!1}return function(o,i,l){var s=function(e){var t={};for(var n in e){var r=e[n];for(var a in r)if("meta"!=a){var o=r[a];t[a]="string"==typeof o?{title:o}:o}}return t}(o),c=function(e){var n;return function(r){if(r in e)return r;if(!n)for(var a in n={},e){var o=e[a];t(o&&o.alias,(function(t){if(t in n)throw new Error(t+" cannot be alias for both "+a+" and "+n[t]);if(t in e)throw new Error(t+" cannot be alias of "+a+" because it is a component.");n[t]=a}))}return n[r]||r}}(s);i=i.map(c),l=(l||[]).map(c);var u=n(i),d=n(l);i.forEach((function e(n){var r=s[n];t(r&&r.require,(function(t){t in d||(u[t]=!0,e(t))}))}));for(var p,f=r(s),m=u;a(m);){for(var h in p={},m){var g=s[h];t(g&&g.modify,(function(e){e in d&&(p[e]=!0)}))}for(var b in d)if(!(b in u))for(var v in f(b))if(v in u){p[b]=!0;break}for(var y in m=p)u[y]=!0}var w={getIds:function(){var e=[];return w.load((function(t){e.push(t)})),e},load:function(t,n){return function(t,n,r,a){var o=a?a.series:void 0,i=a?a.parallel:e,l={},s={};function c(e){if(e in l)return l[e];s[e]=!0;var a,u=[];for(var d in t(e))d in n&&u.push(d);if(0===u.length)a=r(e);else{var p=i(u.map((function(e){var t=c(e);return delete s[e],t})));o?a=o(p,(function(){return r(e)})):r(e)}return l[e]=a}for(var u in n)c(u);var d=[];for(var p in s)d.push(l[p]);return i(d)}(f,u,t,n)}};return w}}();e.exports=t},2703:(e,t,n)=>{"use strict";var r=n(414);function a(){}function o(){}o.resetWarningCache=a,e.exports=function(){function e(e,t,n,a,o,i){if(i!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:o,resetWarningCache:a};return n.PropTypes=n,n}},5697:(e,t,n)=>{e.exports=n(2703)()},414:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},4448:(e,t,n)=>{"use strict";var r=n(7294),a=n(7418),o=n(3840);function i(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n