Last active
August 24, 2022 14:26
-
-
Save tonyspiro/74a96b2971453f1052c5fe17948dfd1d to your computer and use it in GitHub Desktop.
bucket.objects.find example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// bucket.objects.find | |
const data = await bucket.objects | |
.find({ | |
type: "products", // Object Type slug | |
}) | |
.props("title,slug,metadata") // response properties | |
.limit(10); // number of Objects to be returned | |
// bucket.objects.insertOne | |
const data = await bucket.objects | |
.insertOne({ | |
type: "cars", | |
title: "Tesla Model X", | |
content: "Check out the latest style and features!" | |
}) | |
// bucket.objects.updateOne | |
const data = await bucket.objects | |
.updateOne({ | |
id: "12345asdf", | |
$set: { | |
title: "UPDATED Tesla Model X", | |
content: "Check out the UPDATED latest style and features!" | |
} | |
}) | |
// bucket.objects.deleteOne | |
const data = await bucket.objects | |
.deleteOne({ | |
id: "12345asdf" | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment