mongoose
mongoose
  • Version 9.1.0
    • Version 8.21.0
    • Version 7.8.8
    • Version 6.13.8
  • Quick Start
  • Guides
    • Schemas
    • SchemaTypes
    • Connections
    • Models
    • Documents
    • Subdocuments
    • Queries
    • Validation
    • Middleware
    • Populate
    • Discriminators
    • Plugins
    • Timestamps
    • Transactions
    • TypeScript
  • API
    • Mongoose
    • Schema
    • Connection
    • Document
    • Model
    • Query
    • Aggregate
    • SchemaType
    • VirtualType
  • Migration Guide
  • Version Compatibility
  • Version Support
  • FAQ
  • Further Reading
  • For Enterprise
  • Sponsors

Subdocument

Mongoose
Schema
Connection
Document
Model
Query
QueryCursor
Aggregate
AggregationCursor
SchemaType
VirtualType
Error
SchemaArray
SchemaDocumentArray
SchemaSubdocument
SchemaBoolean
SchemaBuffer
SchemaNumber
SchemaObjectId
SchemaString
SchemaUuid
DocumentArray
Subdocument
  • Subdocument.prototype.$parent()
  • Subdocument.prototype.$toObject()
  • Subdocument.prototype.deleteOne()
  • Subdocument.prototype.inspect()
  • Subdocument.prototype.ownerDocument()
  • Subdocument.prototype.parent()
ArraySubdocument
Buffer
Decimal128
Map
Array
Uuid
  • Subdocument.prototype.$parent()
  • Subdocument.prototype.$toObject()
  • Subdocument.prototype.deleteOne()
  • Subdocument.prototype.inspect()
  • Subdocument.prototype.ownerDocument()
  • Subdocument.prototype.parent()

Subdocument.prototype.$parent()

Returns this sub-documents parent document.


Subdocument.prototype.$toObject()

Override $toObject() to handle minimizing the whole path. Should not minimize if schematype-level minimize is set to false re: gh-11247, gh-14058, gh-14151


Subdocument.prototype.deleteOne()

Parameters:
  • [options] «Object»

Null-out this subdoc


Subdocument.prototype.inspect()

Helper for console.log


Subdocument.prototype.ownerDocument()

Returns:
  • «Document»

Returns the top level document of this sub-document.


Subdocument.prototype.parent()

Returns this sub-documents parent document.

Localize
Full Stack Engineer
Anywhere
View more jobs!