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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T22:29:11+00:00 2026-06-04T22:29:11+00:00

Should the existing property be deleted before setting a new value? My implementation keeps

  • 0

Should the existing property be deleted before setting a new value? My implementation keeps adding new entries to files and chunks every time the property is updated.

Blob photo;

public void setPhoto(File file){
    String type = MimeTypes.getContentType(file.getName());
    photo = new Blob(file, type);
    save();
}

Calling:

foo.setPhoto( barFile );

will store the file in gridfs as expected.
Calling it again (to update with a new photo), the previous files remain in mongodb and the property returns the wrong file.

foo.photo.get();

Looking at the example of playmorphia, delete is not required but I am finding it necessary.

playmorphia v1.2.7 module

  • 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-04T22:29:13+00:00Added an answer on June 4, 2026 at 10:29 pm

    You probably want to do the delete yourself after you put the new in. I’d suggest following up with the play plugin people to see if there is an option which does this automatically and will return the latest photo.

    I think you want to store a reference to the filename and not the id of the uploaded file if you want to get the latest one every time. So it would be more of a query than the _id. Once again, probably something to follow up with the play plugin people.

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

Sidebar

Related Questions

I need a custom event that should raise if a new/existing file in a
I have a situation where I'm adding existing entities to an entity collection. Before
I want to generate XML from existing xml but values should come from some
Should be easy. I'm adding a button to each table row, that gets information
Should one use @property for variables that will be accessed very often, such as
Environment There is an existing software with propietary way of clustering, which should be
I'm integrating coredata into my existing application as given in http://wiresareobsolete.com/wordpress/2009/12/adding-core-data-existing-iphone-projects/ . I'm facing
I am currently trying to extend an existing project. Unfortunately I am completely new
How can i overwrite some existing property with a newly created properties file? Here
I'm using M2E for maven integration with eclipse. My unit tests reference property files

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.