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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T13:35:13+00:00 2026-06-12T13:35:13+00:00

I want to save changes made to my document. The easiest way to do

  • 0

I want to save changes made to my document. The easiest way to do this is to store the actual changes made to a document. What I mean:

var changes = {
  $set: {
    text: 'Some text.'
  }
}

db.posts.update({
  _id: _id
}, changes)

db.changes.insert({
  postid: _id,
  changes: changes
})

However I’m getting the error (with good reason):

Error: key $set must not start with '$'

What’s the easiest way to store changes?

Or perhaps I’m approaching the problem wrong and you have a better solution. I want users to be able to see a log of changes people make to any post or, in fact, anything. I’m not going to make a function for every time of change. Editing the text is just one of many ways to make changes to a document.

  • 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-12T13:35:14+00:00Added an answer on June 12, 2026 at 1:35 pm

    This is a limitation within MongoDB. There are certain reserved characters one of them being $ due to how querying must work. When using operators there would be ambiguity between the document in the collection and the document used for updating.

    I would recommend stripping out the $ symbols. I would instead use these words in place of the operators you are trying to use:

    • CREATE
    • SET
    • DELETE
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Say I've made changes to some files but I don't want to check them
Hi i want to save the changes i made in printer preferences but they
I want to save webpage in document directory with the images,css and javascripts etc..
I want to save a matrix to a text file, so I can read
If I want to save any changes in a table, previously saved in SQL
What's the best way to save my MySQL data model and automatically apply changes
I made a Core Data application, and I want to save the file.sqlite to
I want to create previous versions so a user can undo changes made and
I Want to save the value of an inplace if it was changed. The
I want save the username and password when user login, and I added the

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.