db.inventory.insertOne( {
item: "journal",
price: 9.99,
qty: 25,
size: { h: 14, l: 21, w: 1 },
features: "Beautiful, handmade journal.",
categories: ["writing", "bestseller"],
image: "items/journal.jpg"
} )
{
"acknowledged" : true,
"insertedId" : ObjectId("600e814359ba901629a14e13")
}
db.inventory.updateOne(
{ _id: ObjectId("600e814359ba901629a14e13") },
{
$unset: {image: 1, size: 1, qty: 1, price: 1},
$set : {
item: "journal",
features: ["Inner pocket", "Durable cover"],
skus: [ {
sku: "154A",
price: {
base: NumberDecimal(9.99),
currency: "USD"
},
quantity: 20,
options: {
size: { h: 14, l: 21, w: 1 },
features: ["72 sheets of premium lined paper"],
colors: ["brown", "red"],
ruling: "wide",
image: "images/journal1.jpg"
}
}, {
sku: "154B",
price: {
base: NumberDecimal(14.99),
currency: "USD",
discount: NumberDecimal(4.00)
},
quantity: 15,
options: {
size: { h: 18, l: 22, w: 2 },
features: ["140 sheets of premium paper"],
colors: ["brown"],
ruling: "unlined",
image: "images/journals.jpg"
}
} ]
}
}
)
db.customers.updateOne(
{ _id: "journalfanatic@e/mail.com" },
{ $set: {
"address.zip": "60601",
shippingAddress: {
street1: "50 Work Street",
street2: "Floor 16",
city: "Chicago",
state: "IL",
zip: "60601" } },
$setOnInsert: { dateModified: new Date() }
}
)
db.reset.insertOne({
customerId: "journalfanatic@e/mail.com",
token: "493654",
status: "requested",
expiration: new Date(ISODate().getTime() + (1000 * 60 * 30)),
requestTime: new Date()
} )