Skip to content

Instantly share code, notes, and snippets.

@tonyspiro
Last active August 24, 2022 14:26
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save tonyspiro/74a96b2971453f1052c5fe17948dfd1d to your computer and use it in GitHub Desktop.
bucket.objects.find example
// 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