Questions tagged [faunadb]

For questions related to FaunaDB, a strongly consistent multi-model database capable of global horizontal scale with a focus on operational simplicity.

FaunaDB is a strongly consistent database capable of global horizontal scale with a focus on operational simplicity. FaunaDB supports document, relational, graph, and temporal data sets from a single query. In addition to its own FQL query language, the product supports GraphQL, with SQL planned for the future.

Fauna Cloud was opened to the public on March 15, 2017.

Links

250 questions
13
votes
2 answers

How to get all documents from a collection in FaunaDB?

I already have an answer: const faunadb = require('faunadb') const q = faunadb.query exports.handler = async (event, context) => { const client = new faunadb.Client({ secret: process.env.FAUNADB_SERVER_SECRET }) try { // Getting…
Félix Paradis
  • 5,165
  • 6
  • 40
  • 49
12
votes
2 answers

Can I update a FaunaDB document without knowing its ID?

FaunaDB's documentation covers how to update a document, but their example assumes that I'll have the id to pass into Ref: Ref(schema_ref, id) client.query( q.Update( q.Ref(q.Collection('posts'), '192903209792046592'), { data: { text:…
Em.
  • 175
  • 7
12
votes
1 answer

How to fetch fields or schema of a FaunaDB class

Is it possible to fetch FaunaDB class schema or fields through fauna-shell or fauna-java API? I am expecting fields and it datatypes for a given class or instance
Achaius
  • 5,904
  • 21
  • 65
  • 122
10
votes
1 answer

How to get documents that contain sub-string in FaunaDB

I'm trying to retrieve all the tasks documents that have the string first in their name. I currently have the following code, but it only works if I pass the exact name: res, err := db.client.Query( f.Map( …
sainoba
  • 158
  • 1
  • 13
9
votes
4 answers

How to get an ID from Ref in fauna?

I'm fetching documents from faunadb and I would like their ID to be in the payload that I send to the client. This is how I fetch the documents and return their data as a collection serverClient.query( q.Map( …
ProblemsOfSumit
  • 19,543
  • 9
  • 50
  • 61
8
votes
1 answer

FaunaDB application returns 401 but credentials are fine

I wanted to try FaunaDB, so I made a NodeJS application. I followed along a tutorial which made an application like twitter. However, when I try to access database, I get 403 unauthorized message. I have checked my security keys, but I still get the…
Azzarian
  • 153
  • 2
  • 13
7
votes
2 answers

Update if document exists, otherwise create a new document in faunadb

Trying to update a document if it exists, otherwise create a document with the same data. I need to do this using an Index rather than a direct Ref as well. Using this to update in cases where I know for certain it already exists. But in this case,…
gm_
  • 598
  • 6
  • 22
7
votes
4 answers

How to query by multiple conditions in faunadb?

I try to improve my understanding of FaunaDB. I have a collection that contains records like: { "ref": Ref(Collection("regions"), "261442015390073344"), "ts": 1587576285055000, "data": { "name": "italy", "attributes": { …
Sesigl
  • 600
  • 4
  • 17
7
votes
1 answer

CreateIndex with Binding Objects

I have a collection that includes a field of type Time. I need to be able to query this collection by year, or month-year combination. I have tried using the index creation tool on the web site itself, using things like Year(data.expDate) and…
LesC
  • 375
  • 1
  • 2
  • 8
7
votes
2 answers

Is faunadb realtime?

Wondering if faunadb support realtime, which is a big thing firebase supports? I noticed faunadb support graphql but without subscription supported. Sorry if this question is naive?
Ron
  • 6,037
  • 4
  • 33
  • 52
7
votes
2 answers

How to fetch all instances in a FaunaDB class

I have a class "posts" which has 10 instances. How to fetch and list all instances in this class using fauna-java library without using Paginate method? I tried something like follows client.query(Get(Class("posts"))) But couldn't able to achieve…
Achaius
  • 5,904
  • 21
  • 65
  • 122
6
votes
2 answers

How to get nested documents in FaunaDB?

To get a single document in Fauna we do: q.Get(q.Ref(q.Collection('posts'), '192903209792046592')) And we get something like: { data: { title: 'Lorem ipsum', authorId: '892943607792046595' } } Is it possible to instead get the post and…
Pier
  • 10,298
  • 17
  • 67
  • 113
6
votes
1 answer

How to increment value in faunadb? Using javascript and serverside functions

I have a value in my faunadb database that i want to increase by one when clicking a button. I am not sure how to do that i tried it with this: const change = (data) => { return fetch(`/.netlify/functions/todos-update`, { body:…
Skelly
  • 109
  • 1
  • 10
6
votes
1 answer

How To Query (Not List) Child Databases By Data Properties

Is there a way to query child databases by data properties i.e. via index? In multitenancy scenarios we can end up with a ton of child databases and it would be really nice to be able to query them e.g. (child dbs on this version, child dbs that are…
MToTheA
  • 37
  • 5
6
votes
1 answer

How to get the ref(id) of my last instance created

I don't know how to simply get the ref(id) of my last instance created with faunadb. I need to put it in an url. I use this to create my instance: /* code from functions/todos-create.js */ import faunadb from 'faunadb' /* Import faunaDB sdk */ /*…
Math73100
  • 175
  • 8
1
2 3
16 17