1.0.6 • Published 1 year ago
fasterdb v1.0.6
💻 FASTER-DB
An easy-to-use Package to easily manage a simple Database.
🔧 Installation
To install the normal version you can use
npm install fasterdb
If you want to install the latest version you can use
npm install fasterdb@latest
📚 Example Usage
const { connect, Schema, Model } = require('fasterdb');
const userSchema = new Schema({
type: 'object', // Sets the type of the schema
properties: {
_id: { type: 'string' }, // _id must be always defined
name: { type: 'string' },
age: { type: 'number' }
},
required: ['name', 'age'], // Sets what properties are required in this schema
additionalProperties: false
});
const connection = connect('users'); // Connect to the database (If no file exists, a new one will be created)
const User = new Model({ schema: userSchema, connection }); // Creates a new Model with the defined Schema and DB File
const newUser = User.create({ name: 'Alfred', age: 18 });
console.log(newUser);
const users = User.findById(newUser._id);
console.log(users);
// More Code goes here
LICENSE
For more details, see LICENSE