Database Layer
Type-safe OracleObjectModel query builder with native spatial support
Query Builder
Query Type
Table
Available columns:
user_idemailphonecreated_at
Generated Query Code
// Select a query type to generate codeDatabase Features
Not an ORM
Direct SQL control with query builder pattern
No magic, full controlOracle Spatial
Native SDO_GEOMETRY support for geo queries
Location intelligenceBind Parameters
Automatic SQL injection protection
Secure by defaultConnection Pooling
Automatic connection management
High performanceAuto-scaling
Oracle Autonomous scales automatically
No DBA neededType Safety
Column aliasing and type hints
Predictable resultsDatabase Schema
users
Core authentication data
| user_id | NUMBER | PK |
| VARCHAR2(255) | UNIQUE | |
| phone | VARCHAR2(20) | |
| password_hash | VARCHAR2(255) | |
| created_at | TIMESTAMP |
user_profiles
Extended user information
| user_id | NUMBER | FK |
| name | VARCHAR2(100) | |
| bio | CLOB | |
| profile_image | VARCHAR2(500) | |
| location | SDO_GEOMETRY | SPATIAL |
services
Service offerings with spatial data
| service_id | NUMBER | PK |
| user_id | NUMBER | FK |
| title | VARCHAR2(200) | |
| category | VARCHAR2(50) | INDEX |
| location | SDO_GEOMETRY | SPATIAL |
| price | NUMBER(10,2) |
Real-World Example
// Find nearby services with provider details using query()
async function findNearbyServices(userLocation, radiusKm = 5) {
// First, get services within radius using spatial query
const nearbyServices = await OracleObjectModel.spatialProximity({
queryEntity: {
'service_id': 'id',
'title': null,
'category': null,
'price': null,
'user_id': 'providerId',
'distance_km': 'distance'
},
queryTable: 'services',
location: userLocation,
radiusKm: radiusKm
});
// Then get provider details using query() - much cleaner!
const providerIds = nearbyServices.map(s => s.providerId);
const providers = await OracleObjectModel.query(
['user_id:id', 'first_name', 'last_name', 'profile_image:avatar'],
'users',
{ user_id: { $in: providerIds } }
);
// Returns: [{ id, firstName, lastName, avatar }]
// Combine results
return nearbyServices.map(service => ({
...service,
provider: providers.find(p => p.id === service.providerId)
}));
}Continue Learning
Explore more framework features