List of Common Queries - SCCapstone/EZBag GitHub Wiki
- Create
db.product.insertMany([
{ _id: "9d8f57s56776d7", barcode: โ1295783859843โ, barcodeType: โean13โ, name: โapplesโ, price: 1.99, description: โproduceโ, businessID: 1, time: 19748736847 },
{ _id: "97f57s8646s45a", barcode: โ3948689743743โ, barcodeType: โean13โ, name: โsteakโ, price: 10.99, description: โmeatโ, businessID: 2, time: 349879728743 },
{ _id: "3jh5k24546k6n3", barcode: โ2947849385445โ, barcodeType: โean13โ, name: โoreosโ, price: 3.99, description: โcookiesโ, businessID: 2, time: 478373846384 }
]);
db.product.insertOne(
{ _id: "3jh5k24546k6n3", barcode: โ2947849385445โ, barcodeType: โean13โ, name: โoreosโ, price: 3.99, description: โcookiesโ, businessID: 2, time: 478373846384 }
);
- Read
db.cart.find(
{ _id: โ9d8f57s56776d7โ },
{ time: โ129472478โ, total: 10.54 }
);
- Update
db.info.updateOne(
{ _id: โ9d8f57s56776d7โ },
{ $set: { phone: โ7845291093โ} }
);
- Delete
db.info.deleteMany([
{ _id: โ9d8f57s56776d7โ, email: โ[email protected]โ, phone: 8513271443, time: 028492839 },
{ _id: โ97f57s8646s45aโ, email: โ[email protected]โ, phone: 8724351234, time: 129472478 },
{ _id: โ3jh5k24546k6n3โ, email: โ[email protected]โ , phone: 3057618882, time: 376857393 }
]);
db.info.deleteOne([
{ _id: โ9d8f57s56776d7โ, email: โ[email protected]โ, phone: 8513271443, time: 028492839 }
]);
- Search
db.product.find(
{ barcode: โ1295783859843โ }
);
db.product.find(
{ name: /.*"apple".*/ }
);
Create and Update will need to join tables.