Posts

Showing posts from September, 2024

MongoDB Exercise :2

 studentsB> db.aids.find().count() 4 studentsB> db.aids.find().count() 4 studentsB> db.aids.find().limit(3) [   {     _id: ObjectId("66fa2428ca0fc631a23b264f"),     SRN: 201,     SName: 'A',     yr: 3   },   {     _id: ObjectId("66fa2479ca0fc631a23b2650"),     SRN: 202,     SName: 'B',     yr: 3   },   {     _id: ObjectId("66fa249eca0fc631a23b2652"),     SRN: 303,     SName: 'CC',     yr: 3   } ] studentsB> db.aids.find().limit(2) [   {     _id: ObjectId("66fa2428ca0fc631a23b264f"),     SRN: 201,     SName: 'A',     yr: 3   },   {     _id: ObjectId("66fa2479ca0fc631a23b2650"),     SRN: 202,     SName: 'B',     yr: 3   } ] studentsB> db.aids.find().sort() [   {     _id: ObjectId("66fa2428ca0fc631a23b264f"), ...

MongoDB 12 a: Create and drop database and collection

use LibraryG  command creates LibraryG database. In  LibraryG  database to create collection named " books "  db.books.insertOne({Name:'abc', pages:200})   it is implicit way  In MongoDB, you can drop a database using the db.dropDatabase() method, and you can drop a collection using the db.collection.drop() method. Here's how you can use these commands: Drop a Collection : To drop a specific collection in MongoDB, you can use the db.collection.drop() method. Replace collection with the name of the collection you want to drop. Here's an example: use your_database_name // Switch to the appropriate database db.your_collection_name.drop() Replace your_database_name with the name of your database and your_collection_name with the name of the collection you want to drop. Drop a Database : To drop an entire database in MongoDB, you can use the db.dropDatabase() method. Be very careful when using this command because it will permanently delete the enti...

MongoDB

 abc123> db.eswar.insertOne({SRN:001,SName:'a',yr:3}) {   acknowledged: true,   insertedId: ObjectId("66f392b1d8b1cbf0117c527c") } abc123> db.eswar.insertOne({SRN:002,SName:'b',yr:3}) {   acknowledged: true,   insertedId: ObjectId("66f392cbd8b1cbf0117c527d") } abc123> db.eswar.insertOne({SRN:003,SName:'c',yr:2}) {   acknowledged: true,   insertedId: ObjectId("66f392e3d8b1cbf0117c527e") } abc123> db.eswar.find() [   {     _id: ObjectId("66f392b1d8b1cbf0117c527c"),     SRN: 1,     SName: 'a',     yr: 3   },   {     _id: ObjectId("66f392cbd8b1cbf0117c527d"),     SRN: 2,     SName: 'b',     yr: 3   },   {     _id: ObjectId("66f392e3d8b1cbf0117c527e"),     SRN: 3,     SName: 'c',     yr: 2   } ] abc123> show collections eswar abc123> db.eswar.update({SName:'C'},{$set:{yr:3}}) DeprecationWarni...

Mean stack status

 https://docs.google.com/forms/d/e/1FAIpQLSdBj6rR-vVcndcBeALeNEZuG3clwekFdMr71imXZbdQhYz9qA/viewform?usp=sharing