Home » Entertainment » Database Operations on “books” Collection in MongoDB

Database Operations on “books” Collection in MongoDB

use data1 db.createCollection(“books”) db.libros.insertOne( _id: 1, title: “El Aleph”, author: name: “Jorge Luis Borges”, nationality: “Argentina” , publisher: [“Siglo XXI”, “Planeta”]price: 20, quantity: 50 ) db.libros.insertOne( _id: 2, title: “Martín Fierro”, author: name: “José Hernández”, nationality: “Argentina” , publisher: [“Siglo XXI”]price: 50, quantity: 12 ) db.libros.insertOne( _id: 3, title: “Learn PHP”, author: name: “Mario Molina”, nationality: “Spain” , publisher: [“Siglo XXI”, “Planeta”]price: 50, quantity: 20 ) db.libros.insertOne( _id: 4, title: “Java in 10 minutes”, author: name: “Juan Pérez”, nationality: “Spain” , publisher: [“Siglo XXI”]price: 45, quantity: 1 ) db.libros.find(“author.nationality”: “Argentina”) db.libros.find(“author.nationality”: “Spain”) db.libros. find( “author.name”: “Jorge Luis Borges” ) db.libros.find( quantity: $gte: 10 ) db.libros.find( publisher: “Siglo XXI” )
2023-10-26 02:23:48
#Books #MongoDB #myCompiler

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.