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 9014305
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T03:28:34+00:00 2026-06-16T03:28:34+00:00

Suppose I have a document for example: var doc = Model.findOne({name:name}); Now if the

  • 0

Suppose I have a document for example: var doc = Model.findOne({name:”name”});

Now if the document gets edited trough another connection the the database, doc doesn’t hold the right information. I do need it, so I have to “refresh” or “redownload” it from the database. Is there any way to do this with only the object “doc”?

  • 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-16T03:28:35+00:00Added an answer on June 16, 2026 at 3:28 am

    Assuming doc contains the document instance to refresh, you can do this to generically refresh it:

    doc.model(doc.constructor.modelName).findOne({_id: doc._id},
        function(err, newDoc) {
            if (!err) {
                doc = newDoc;
            }
        }
    );
    

    However, it’s better to not persist/cache Mongoose document instances beyond your immediate need for them. Cache the immutable _id of docs you need to quickly access, not the docs themselves.

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

Sidebar

Related Questions

Suppose I have this jQuery code. $(document).delegate('a[title]', 'click', function(event) { var txt = //
Let's suppose I have a Word model with this schema var Word = new
Suppose I have a source example document like this: <html> <b><i><u>TestBIU</u></i></b> <i><b><u>TestIBU</u></b></i> <i><u><b>TestIUB</b></u></i> <b><u><i>TestBUI</i></u></b>
Suppose I have an XML document stored as an Anti-XML Elem : val root
Possible Duplicate: How to Deserialize XML document Suppose that I have a class that
Suppose I have a large list of words. For an example: >>> with open('/usr/share/dict/words')
Suppose we have the name written in any none-latin letters - languages, like Arabic,
Suppose I have the following HTML snippet: <input type=text id=myinput /> Now I want
Suppose I have a table, Document, that looks something like this: _______________________ | Document
Suppose that I have a document like this, and I want to search for

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.