
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@k-logeshwaran/toydb-query
Advanced tools
The ToyDbQuery class is a client library for interacting with the ToyDB . It provides methods for performing various database operations, including listing collections, creating collections, adding records, querying records, finding records by ID, and more.
Creates a new instance of ToyDbQuery with the specified ToyDB API URL.
url (string): The URL of the ToyDB API.Retrieves a list of all collections in the database.
Creates a new collection with the specified name.
collectionName (string): The name of the new collection.Adds a new record to the specified collection.
collectionName (string): The name of the collection to add the record to.data (object): An object containing the data to be added as a new record.Queries records from a collection with optional limiting.
options (object):
collection (string): The name of the collection to query.limit (optional, number): The maximum number of records to retrieve (default: 10).Finds a record in a collection by its ID.
options (object):
collection (string): The name of the collection to search.id (string): The ID of the record to find.Queries records from a collection where a specific field matches a value.
options (object):
collection (string): The name of the collection to query.field (string): The field to match.value (any): The value to match against the specified field.Updates a record in a collection with a new value for a specific field.
options (object):
collection (string): The name of the collection to update.field (string): The field to update.value (any): The new value to set for the specified field.id (string): The ID of the record to update.Adds a new field with a value to a record in a collection.
options (object):
collection (string): The name of the collection to update.field (string): The new field to add.value (any): The value to set for the new field.id (string): The ID of the record to update.const ToyDbQuery = require('toy-db-query'); // For CommonJS
// or
import ToyDbQuery from 'toy-db-query'; // For ES6 modules
// Create a new instance with the ToyDB API URL
const toyDb = new ToyDbQuery('https://example.com/toydb-api');
// List all collections
toyDb.listCollection()
.then((collections) => {
console.log('Collections:', collections);
})
.catch((error) => {
console.error('Error:', error);
});
// Create a new collection
toyDb.createCollection('myNewCollection')
.then((message) => {
console.log('Collection created:', message);
})
.catch((error) => {
console.error('Error:', error);
});
// Add a new record to a collection
const data = { name: 'John', age: 30 };
toyDb.addRecord('myCollection', data)
.then((message) => {
console.log('Record added:', message);
})
.catch((error) => {
console.error('Error:', error);
});
// Query records from a collection
const queryOptions = { collection: 'myCollection', limit: 5 };
toyDb.query(queryOptions)
.then((records) => {
console.log('Queried records:', records);
})
.catch((error) => {
console.error('Error:', error);
});
// Find a record by ID
const findOptions = { collection: 'myCollection', id: '123456' };
toyDb.find(findOptions)
.then((record) => {
console.log('Found record:', record);
})
.catch((error) => {
console.error('Error:', error);
});
// Query records where a specific field matches a value
const whereOptions = { collection: 'myCollection', field: 'age', value: 30 };
toyDb.where(whereOptions)
.then((matchingRecords) => {
console.log('Matching records:', matchingRecords);
})
.catch((error) => {
console.error('Error:', error);
});
// Update a record in a collection
const updateOptions = { collection: 'myCollection', field: 'name', value: 'UpdatedName', id: '123456' };
toyDb.updateRecord(updateOptions)
.then((message) => {
console.log('Record updated:', message);
})
.catch((error) => {
console.error('Error:', error);
});
// Add a new field to a record in a collection
const addFieldOptions = { collection: 'myCollection', field: 'newField', value: 'NewFieldValue', id: '123456' };
toyDb.addNewField(addFieldOptions)
.then((message) => {
console.log('New field added:', message);
})
.catch((error) => {
console.error('Error:', error);
});
This project is licensed under the ISC License. See the LICENSE file for details.
Please report bugs and issues on the GitHub Issues page.
FAQs
utility for managing ToyDB
We found that @k-logeshwaran/toydb-query demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.