lab7
// Insert a document into a collection named 'users'
db.users.insertOne({ name: "John", age: 30, city: "New York" });
// Find all documents in the 'users' collection
db.users.find();
// Find documents with a specific condition
db.users.find({ age: { $gte: 25 } }); // Find users with age greater than or equal to 25
// Update a document in the 'users' collection
db.users.updateOne({ name: "John" }, { $set: { age: 35 } });
// Delete a document from the 'users' collection
db.users.deleteOne({ name: "John" });
Comments
Post a Comment