Help & Troubleshooting
Code:
mongodb+srv://<username>:<password>@myclass.9fnerah.mongodb.net/<database_name>?retryWrites=true&w=majority
mongodb+srv://John:[email protected]/Product?retryWrites=true&w=majority
{"name":"John Doe",
"age":24
}
{
"name": "John Doe",
"age": {
"$numberInt": "28"
},
"isDeveloper": true,
"createdAt": {
"$date": "2024-10-06T10:30:00Z"
},
"balance": {
"$numberDecimal": "1000.123456789"
},
"height": {
"$numberDouble": "5.75"
},
"Num1_64": {
"$numberLong": "546"
},
"Num2_32": {
"$numberInt": "10"
},
"infiniteNumber1": {
"$numberDouble": "Infinity"
},
"bin04": {
"$binary": {
"base64": "NTUwZTg0MDBlMjliNDFkNGE3MTY0NDY2NTU0NDAwMDA=",
"subType": "00"
}
},
"projects": [
{
"title": "Chat Application",
"year": {
"$numberInt": "2061"
},
"technologies": [
"React",
"Node.js",
"MongoDB"
]
},
{
"title": "E-commerce Website",
"year": {
"$numberInt": "2024"
},
"technologies": [
"MERN Stack",
"Express"
]
}
],
"projects2": [
{
"title": "Chat Application 23",
"year": {
"$numberInt": "2025"
},
"technologies": [
"React",
"Node.js",
{
"$numberInt": "28"
}
]
}
],
"Regex_1": {
"$regularExpression": {
"pattern": "^Anurag$",
"options": "i"
}
},
"timestampField": {
"$timestamp": {
"t": 1565545664,
"i": 1
}
},
"uuid": {
"$uuid": "3b241101-e2bb-4255-8caf-4136c566a962"
},
"Binary_data_1": {
"bin1": {
"$binary": {
"base64": "SGVsbG8sIFdvcmxkIQ==",
"subType": "00"
}
},
"bin2": {
"$binary": {
"base64": "SGVsbG8gU2FyYW5zaCBLYWlzZSBobw==",
"subType": "00"
}
}
},
"userId": {
"$oid": "60ad4e26adf5692f72b57a28"
}
}
db.collection.createIndex({ fieldName: 1 }, { unique: true });
db.collection.createIndex({ fieldName: 1 }, { partialFilterExpression: { status: "active" } });
db.collection.createIndex({ optionalField: 1 }, { sparse: true });
db.collection.createIndex({ textField: "text" });
db.collection.createIndex({ username: 1, email: 1 }, { unique: true });