
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
veddb-client
Advanced tools
Official JavaScript/TypeScript client for VedDB v0.2.0 - MongoDB-like API with verified wire protocol
Modern JavaScript/TypeScript client for VedDB v0.2.0 with Mongoose-like API
npm install veddb
# or
yarn add veddb
# or
pnpm add veddb
import veddb, { Schema, model } from 'veddb';
// Connect to VedDB server
await veddb.connect('localhost', 50051);
// Define a schema
const userSchema = new Schema({
name: { type: String, required: true },
email: { type: String, required: true, unique: true },
age: { type: Number, min: 0, max: 120 },
createdAt: { type: Date, default: Date.now }
});
// Create a model
const User = model('User', userSchema);
// Create a document
const user = await User.create({
name: 'Alice',
email: 'alice@example.com',
age: 30
});
// Find documents
const users = await User.find({ age: { $gt: 25 } });
// Update
await User.updateOne({ name: 'Alice' }, { age: 31 });
// Delete
await User.deleteOne({ name: 'Alice' });
import veddb, { Schema, model, Document } from 'veddb';
interface IUser extends Document {
name: string;
email: string;
age: number;
createdAt: Date;
}
const userSchema = new Schema<IUser>({
name: { type: String, required: true },
email: { type: String, required: true },
age: { type: Number },
createdAt: { type: Date, default: Date.now }
});
const User = model<IUser>('User', userSchema);
const user: IUser = await User.findOne({ email: 'alice@example.com' });
// Connect with options
await veddb.connect('localhost', 50051, {
poolSize: 10,
auth: {
username: 'admin',
password: 'password'
},
tls: {
enabled: true
}
});
// Connection events
veddb.connection.on('connected', () => console.log('Connected!'));
veddb.connection.on('error', (err) => console.error(err));
// Disconnect
await veddb.disconnect();
const schema = new Schema({
// Basic types
name: String,
age: Number,
active: Boolean,
birthday: Date,
// With options
email: {
type: String,
required: true,
unique: true,
lowercase: true,
trim: true
},
// Nested objects
address: {
street: String,
city: String,
zip: String
},
// Arrays
tags: [String],
friends: [{ type: Schema.Types.ObjectId, ref: 'User' }],
// Default values
createdAt: { type: Date, default: Date.now },
// Custom validators
password: {
type: String,
validate: {
validator: (v) => v.length >= 8,
message: 'Password must be at least 8 characters'
}
}
});
// Add methods
schema.method('getFullName', function() {
return `${this.firstName} ${this.lastName}`;
});
// Add statics
schema.static('findByEmail', function(email) {
return this.findOne({ email });
});
// Add hooks
schema.pre('save', function(next) {
this.updatedAt = new Date();
next();
});
schema.post('save', function(doc) {
console.log('Document saved:', doc._id);
});
// Create
const user = new User({ name: 'Bob', age: 25 });
await user.save();
// OR
await User.create({ name: 'Charlie', age: 35 });
await User.insertMany([{ name: 'Dave' }, { name: 'Eve' }]);
// Read
const all = await User.find();
const filtered = await User.find({ age: { $gte: 30 } });
const one = await User.findOne({ name: 'Alice' });
const byId = await User.findById('507f1f77bcf86cd799439011');
// Update
await User.updateOne({ name: 'Bob' }, { age: 26 });
await User.updateMany({ age: { $lt: 30 } }, { status: 'young' });
await User.findByIdAndUpdate(id, { age: 27 }, { new: true });
// Delete
await User.deleteOne({ name: 'Bob' });
await User.deleteMany({ age: { $lt: 18 } });
await User.findByIdAndDelete(id);
// Count
const count = await User.countDocuments({ age: { $gt: 30 } });
const exists = await User.exists({ name: 'Alice' });
// Chainable queries
const users = await User
.find({ status: 'active' })
.where('age').gt(25).lt(50)
.where('city').equals('NYC')
.sort({ age: -1, name: 1 })
.limit(10)
.skip(5)
.select('name email age')
.exec();
// Query operators
query.where('age').gt(25); // Greater than
query.where('age').gte(25); // Greater than or equal
query.where('age').lt(50); // Less than
query.where('age').lte(50); // Less than or equal
query.where('name').equals('Alice');
query.where('status').in(['active', 'pending']);
query.where('city').ne('NYC'); // Not equal
query.where('tags').all(['javascript', 'nodejs']);
query.where('name').regex(/^A/);
// Sorting
query.sort({ age: -1 }); // Descending
query.sort('name'); // Ascending
query.sort('-age name'); // Multiple fields
// Pagination
query.limit(20);
query.skip(40);
// Field selection
query.select('name email'); // Include
query.select('-password -secret'); // Exclude
const results = await User.aggregate([
{ $match: { age: { $gt: 25 } } },
{ $group: {
_id: '$city',
avgAge: { $avg: '$age' },
count: { $sum: 1 }
}},
{ $sort: { count: -1 } },
{ $limit: 10 }
]);
VedDB Server is available as a Docker image:
docker pull mihirrabariii/veddb:latest
docker run -d -p 50051:50051 mihirrabariii/veddb:latest
Then connect from your app:
await veddb.connect('localhost', 50051);
See the examples directory for more:
MIT © Mihir Rabari
Contributions are welcome! Please open an issue or PR.
FAQs
Official JavaScript/TypeScript client for VedDB v0.2.0 - MongoDB-like API with verified wire protocol
The npm package veddb-client receives a total of 0 weekly downloads. As such, veddb-client popularity was classified as not popular.
We found that veddb-client demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.