Skip to content

Instantly share code, notes, and snippets.

@ryanmats
Created April 17, 2018 04:39
Show Gist options
  • Save ryanmats/3f3bb5b3672126871ca5c3f59650135e to your computer and use it in GitHub Desktop.
Save ryanmats/3f3bb5b3672126871ca5c3f59650135e to your computer and use it in GitHub Desktop.
require "google/cloud/firestore"
firestore = Google::Cloud::Firestore.new
frank_ref = firestore.doc "users/frank"
frank_ref.set({
name: "Frank",
favorites: {
food: "Pizza",
color: "Blue",
subject: "Recess"
},
age: 12
})
nested_field_path = Google::Cloud::Firestore::FieldPath.new(
:favorites, :color
)
frank_ref.update({ age: 13, nested_field_path: "Red" })
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment