NoSQL

Check the deadline before returning the copy

BOTIE

Connect now and the extracted expires_at field to the deadline comparison. Inspect its Boolean result before choosing a value.
Ready to test
0 passed · 0 failed · 1 not run

An empty floor. Start with the information your machine needs.

Received result

Your answer will arrive here.

Examples, experiments and workspace controls
Live values

Connect a tool's inputs to see what it produces. You can try a branch before connecting it to Result.

Try your own inputs

Use a copy of the example to try your own data. Keep the problem's assumptions in mind, and predict the effect of a change before checking the output. You can also add another branch to compare two ways of doing the calculation.

Start at an output arrow, then click or drag to an input. Drag empty space to pan. Delete removes a selection. Ctrl/Cmd+Z undoes a change.
Context for this challenge

Connect now and the extracted expires_at field to the deadline comparison. Inspect its Boolean result before choosing a value.

Botie has a saved count, a clock and the current source count.

Inspect the component calculation
Is the clock before expiry?(
  Current time: Current time in seconds
  Expiry time: Read a document path(
    Document: Cached count and deadline
    Field path: expires_at
  )
)
Examples and results
Current time in seconds
119
Cached count and deadline
{
  "value": 18,
  "expires_at": 120
}
Required result
true
Try a fresh construction

This clears this draft, including its undo history. Earlier successful attempts stay recorded. Build again without opening hints to record an independent attempt.

Stuck? Inspect a worked construction

The tools below form one possible solution. You can assemble it, follow its signals, and undo that change to return to your own construction.

Assumptions and test precision

The browser runs an explicit model of the mechanism. It does not connect to MongoDB or Redis, simulate their query planners, or establish their concurrency guarantees. Numerical tests allow a difference of 0.001. Lists and structures must also have the right shape.

Your last tested pieces can start the full construction. An existing draft there keeps its own pieces.

A cached zero remains eligible

This check uses the pieces from “Choose the copy using the clock”.

BOTIE

The saved value is zero, its expiry is 50, and now is 49. The source has already changed to 6. Predict the result under the stated deadline policy.
Cached count and deadline
{
  "value": 0,
  "expires_at": 50
}
Current time in seconds
49
Current source count
6

Use a number, text, or an array matching the requested result. For a matrix, put each row in brackets. Saving your prediction runs your current construction on these inputs and checks the earlier examples too.

Build a construction in the workspace above first. This case will test those pieces.

At 119 the source already differs from the cached value. What has the passing deadline test established, and what has it not established?

The code can enforce an allowance for stale data. The application still has to justify that allowance.

The browser runs an explicit model of the mechanism. It does not connect to MongoDB or Redis, simulate their query planners, or establish their concurrency guarantees.

Work through the Python challenges →
Continue the courseCan One Record Describe the Pump and Its Sensor? →
← Which P1 Did the Lookup Mean?