Python Client API
Complete API reference for the NexaDB Python client library.
Installation
Terminal
$pip install nexaclient
Quick Example
example.pynexaclient
from nexaclient import NexaClient
with NexaClient(
host='localhost',
port=6970,
username='root',
password='nexadb123'
) as db:
user = db.create('users', {
'name': 'Alice',
'email': 'alice@example.com'
})
print(user)Core Methods
connect()
Establish connection to NexaDB server
db.connect()
create(collection, data)
Create a new document in a collection
doc = db.create('users', {'name': 'John'})
get(collection, document_id)
Retrieve a document by its ID
user = db.get('users', 'doc_123')
update(collection, document_id, data)
Update an existing document
db.update('users', 'doc_123', {'name': 'Jane'})
delete(collection, document_id)
Delete a document by its ID
db.delete('users', 'doc_123')
query(collection, filter, limit)
Query documents with filters
results = db.query('users', {'age': {'$gt': 18}}limit=10)