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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:42:37+00:00 2026-05-26T01:42:37+00:00

In the following snippet, I am able to remove two key fields from a

  • 0

In the following snippet, I am able to remove two key fields from a
collection with different parameters (i.e. One is 1 and the other is 0).

> i = { name : 'name', age : 25, gender : 'female' };
{ "name" : "name", "age" : 25, "gender" : "female" }
> db.users.insert(i)
> db.users.find()
{ "_id" : ObjectId("4e8b5b5e654f46ccc304e44e"), 
  "name" : "name", "age" : 25, "gender" : "female" }
> db.users.update({ name : 'name'}, 
                  {$unset : {age : 1, gender : 0}}) // check here
> db.users.find()
{ "_id" : ObjectId("4e8b5b5e654f46ccc304e44e"), "name" : "name" }
> 

Reference: MongoDB $unset

Question> What is the usage of 1 in the following manual?

{ $unset : { field : 1} }

  • 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-05-26T01:42:38+00:00Added an answer on May 26, 2026 at 1:42 am

    As far as I know, this is simply due to JSON/BSON syntax. There has to be a value, but it doesn’t matter what the value is. In the MondoDB documentation they typically use 1.

    MongoDB : Update Modifier semantics of "$unset"

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

Sidebar

Related Questions

The following snippet from RuntimeUtil.java from jlibs guarantees GC that garbage collection is done.
I am able to get the carrier name using the following snippet : TelephonyManager
I'm trying to convert following java snippet to Xtend, but i couldn't able to
Following snippet attempts to write the name of directories and files present in some
The following snippet is from a little app I wrote using the Qt framework.
I'm pulling data from Dynamics AX 2009 from c# using the following code snippet.
Before POST-ing a form with text fields, I'm able to convert curly quotes from
I have the following snippet of XSL: <xsl:for-each select=item> <xsl:variable name=hhref select=link /> <xsl:variable
I have a following snippet from a CSS style sheet, .header {min-height: 62px; background:
I want to pull posts from a users Facebook wall. The following code snippet

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.