Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8244385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:50:10+00:00 2026-06-07T21:50:10+00:00

In Mongoose , I can declare Schemas and also I can use DBRef which

  • 0

In Mongoose,

I can declare Schemas and also I can use

DBRef

which is simply putting ObjectId or an Array of ObjectId

and populate(get) those items.

I think it would be problem when a DBRef removal is needed.

Is there any way to possibly sync removal of DBref?

For example

  1. Removal of a DBRef from an array should remove that of DBRef in other collections and also pull out that DBRef from arrays of DBRef in different collections
  2. Removal of a document (DBRef from this document’s Schema) also removes that of DBRef in other collections and also pull out that DBRef from arrays of DBRef in different collections

Are these possible? If so, how can I achieve these? Or any other Model design suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:50:12+00:00Added an answer on June 7, 2026 at 9:50 pm

    You can use schema.pre('remove', ... middleware to implement your own cascaded removal of ObjectId references in other collections. this._id identifies the document being removed in your middleware function.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

in Mongoose i have two Schemas, which are linked using Mongoose populate : var
I could use some help here, I can't figure out why the populate method
I am using Mongoose 2.7.0 with node.js. How can I describe a schema with
I am using mongoose/nodejs to get data as json from mongodb. For using mongoose
I have the following Schemas in Mongoose/Node.js: var ItemsSchema = new Schema({ itemname: String,
I am trying to figure out how to use mongoose-joins for Node.js. I have
How do I get an asynchronous result back in nodeunit and mongoose? I've tried
Using express.js and everyauth with mongoose-auth, how can I create an external authentication route
I have a mongoose setup which involves an embedded-schema, lets say: A Blogpost with
I am trying to learn how to use Node, Mongoose, and Mongo by looking

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.