Event streaming: email also on field change? Create DB copy?


We are not using Fauna yet since we are still in the process of deciding for NoSQL or SQL (postgreSQL) resp. our current database (Ninox). However, it would help to have answers to these questions:

We need to send an email if the Delivery date field is changed (from null to a date). Currently, this is done by clicking on a button in a web app (or a form builder) triggering a REST API PUT command. It works fine (via Integromat or Pipedream). However, this document (How to use event streaming | Fauna Documentation) as well as a video on YouTube do not clearly say if a field change can trigger an event. The doc says: " field value change (when the set is defined by an index’s terms or values fields)". Does this mean it IS actually possible?

We plan to sell the final “product”. Is it possible to create a copy of the complete database (within our instance) and/or move it into the instance of our customer? Furthermore, most but not all of the data should be removed from the database (after creating a copy). E.g., we need to retain language combinations (we are a translation agency) but remove prices, customer data, etc.

Finally, we might need a Fauna expert who does some work for us. Is there kind of job board out there?

Best regards,
Bertrand Gillert
LocaSoft GmbH, Germany

Does this mean it IS actually possible?


There are 2 kinds of streaming. Document streaming, per the documentation, sends an event notification when a subscribed document changes, including any field value changes. Set streaming sends an event notification when membership in the set changes. Changes to document fields can involve set membership changes, such as when an index defines an email address field as a term; when an email address changes, the matching set for a specific email address would change.

There is often no need for streaming to accomplish this. Wouldn’t your application know when an email address field was changed? If it does, then it can arrange to send emails or perform other operations when notable changes occur.

As for copying a database, it is possible, but this is not a self-serve operation. Contact our support team and they’ll help you achieve that goal.

An alternative would be to sign up for a team account, and at the point of transfer, create a new owner for the recipient of the database, and they can remove you as the owner. Then they can revoke any existing keys that your team might have.

Hi Ewan,

Thank you for this quick and helpful answer!
Just one note re: Wouldn’t your application know when an email address field was changed?

It wouldn’t know. It’s an external translator who will click on a I’ve finished button; the database is then informed (via a REST API string or whatever) and change the delivery date (not an email address) to today’s date.
I understand what you say about “set membership changes” but including a date in an index usually doesn’t make much sense. In my long career I never searched for a delivery date :slight_smile: Just for your information: This change is triggering the next step of a workflow: after the translator has delivered, the next step (proof-reading) should be started automatically.

Also thank you for the “copy database” information. We will probably need them eventually.

I think we should start with FaunaDB; it’s an amazing concept and I like to explore new tools.

Have a great day! Best rgards,

Hi Ewan,

I just had a look into the MongoDB docs. They have a feature allowing for checking whether a specific field has changed:

The following Match Expression configures a trigger to fire only if the change event object specifies that the Status field in a document changed.
“updateDescription.updatedFields.status”: {
“$exists”: true

Does FaunaDB offers a similar feature?

And last but not least: Could you recommend somebody (a freelancer …) who could help us (paid)?

Kind regards,

Hi @LocaSoft,

Disclaimer: set streams are in beta and are not recommended for production workloads. Use with care.

Yep, Fauna definitely has a similar feature, and you linked to the documentation that describes it above: event streaming. In this case, you would construct an index that matches on the term you want to monitor, then subscribe to that set stream. So if you’re monitoring for a change to an email address field and then returning the entire document it might look like this:

First the index:

  name: 'email-change',
  source: Collection('users'),
  terms: [
    { field: ['data','email']}
  values: [
    { field: ['ref']}

Then in your client you would define the stream (this example uses JavaScript, you can see the full example in our documentation):

var setRef = q.Match(q.Index('email-change'))
var streamOptions = { fields: ['ref'] }

Lastly you would construct the stream itself so that whenever it detects a change on that index it can take whatever action you deem necessary.

You mentioned previous experience with indexes and I think this might be the source of some confusion. Indexes in Fauna are slightly different from indexes in other databases you may have used. They’re used to look up records, just like traditional indexes, but they also function as materialized views because you can set not just the term by which to index but also the selection of values to be returned. They’re also at the heart of much of how Fauna works, and are integral to things like set streams. The index tutorial goes into greater detail about what they are and how they work.

There are several freelancers and web dev shops we’ve worked with and can recommend. To help you find someone that’s a good fit can you tell us which time zone you’re in?


Hi Cory,

Thank you! As I mentioned before, it’s the change of a Date field, not an email address. Basically this makes no difference but even with your explanation (which is very clear) I’m not sure whether using a date field for an index isn’t creating too much obsolete index data. Anyway, this Delivery date field would be the only item in the index and would only be used for triggering the Send mail. If you say that this is not impacting the overall performance (too much), then it’s the solution.

I’m in France but my company is in Germany. Some references would be highly welcome. Thanks!

Best regards,

You did say date, not sure why my brain swapped that for email. Clearly I have not had enough coffee this morning. :wink:

I’ll DM you some options for freelancers in Europe. I should have that list together later today.