Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/mongoose/types/index.d.ts>mongoose.ToObjectOptions

MongoDB object modeling designed to work in an asynchronous environment.
Go to Latest
interface mongoose.ToObjectOptions
import { type mongoose } from "https://deno.land/x/mongoose@7.8.2/types/index.d.ts";
const { ToObjectOptions } = mongoose;

Type Parameters

optional
THydratedDocumentType = HydratedDocument<unknown>

Properties

optional
getters: boolean

apply all getters (path and virtual getters)

optional
virtuals: boolean | string[]

apply virtual getters (can override getters option)

optional
aliases: boolean

if options.virtuals = true, you can set options.aliases = false to skip applying aliases. This option is a no-op if options.virtuals = false.

optional
minimize: boolean

remove empty objects (defaults to true)

optional
transform: boolean | ((
ret: Record<string, any>,
) => any)

if set, mongoose will call this function to allow you to transform the returned object

optional
depopulate: boolean

if true, replace any conventionally populated paths with the original id in the output. Has no affect on virtual populated paths.

optional
versionKey: boolean

if false, exclude the version key (__v by default) from the output

optional
flattenMaps: boolean

if true, convert Maps to POJOs. Useful if you want to JSON.stringify() the result of toObject().

optional
flattenObjectIds: boolean

if true, convert any ObjectIds in the result to 24 character hex strings.

optional
useProjection: boolean

If true, omits fields that are excluded in this document's projection. Unless you specified a projection, this will omit any field that has select: false in the schema.