- MongoDB Version
- Execution of a JavaScript file in MongoDB
- Complementary Terms
- Installation
- Basic commands on mongo shell
- Hello World
- Update
- Delete
- Read
- Update of embedded documents
- More update operators
- multi Parameter while updating multiple documents
- CRUD Operation Section Create
- Getting database information
- Find
- FindOne
- limit skip sort and count the results of the find method
- Query Document - Using AND OR and IN Conditions
- find method with Projection
- Find method with Projection
- Update Operators
- Upserts and Inserts
- Create a Collection
- Drop Collection
- Aggregation
- Count
- Sum
- Average
- Operations with arrays
- Aggregate query examples useful for work and learning
- Match
- Get sample data
- Remove docs that have a duplicate field in a collection dedupe
- Left Outer Join with aggregation Lookup
- Server Aggregation
- Aggregation in a Server Method
- Java and Spring example
- Index Creation Basics
- Dropping Deleting an Index
- Sparse indexes and Partial indexes
- Get Indices of a Collection
- Compound
- Single field-Delete
- Converting a field to another type and updating the entire collection in Bulk
- Create a 2dsphere Index
- Pluggable Storage Engines-WiredTiger
- Create a database user
- Fetch Collection data with condition
- Create a tailable cursor
- Python Driver
- Connect to MongoDB using pymongo
- PyMongo queries
- Update all documents in a collection using PyMongo
- Sharding Environment Setup
- Basic configuration with three nodes
- Mongodb as a Replica Set
- Check MongoDB Replica Set states
- MongoDB - Configure a ReplicaSet to support TLS SSL
- How to configure a ReplicaSet to support TLS SSL
- How to connect your Client Mongo Shell to a ReplicaSet
- Authentication Mechanisms in MongoDB
- MongoDB Authorization Model
- Configuration
- Backing up and Restoring Data
- mongoimport with JSON
- mongoimport with CSV
- Upgrading MongoDB version
Mongodb Lesson
We lost Tom's age & name! From this example, we can know that the whole document will be overrided if without any update operator in update statement. This is the default behavior of MongoDB.
III.$set operator
If we want to change only the 'sex' field in Tom's document, we can use $set to specify which field(s) we want to update:
The value of $set is an object, its fields stands for those fields you want to update in the documents, and the values of these fields are the target values.
So, the result is correct now:
Also, if you want to change both 'sex' and 'age' at the same time, you can append them to $set :
Anil Bist
Skills Mongodb
Qualifications :- High School - SLV, College/University - Graphic Era Deemed Univ University,Location :-Dehradun,Dehradun,Uttarakhand,India
Description:-
I started my Professional Journey in 2006 with one of the Web Development Company in Bangalore and my 1st framework was "Ruby on Rail" as Web development and delivered around 5+ Projects using this platform. Then came another dimension as JEE/Sturst framework, Gradually I realized that I want to build something on my own and give my passion and energy on creating something different a
Explore