Skip to main content
The Deno 2 Release Candidate is 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@6.13.0/types/index.d.ts";
const { ToObjectOptions } = mongoose;

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 | ((
doc: any,
ret: any,
options: 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
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.