oknoah / final-orm Goto Github PK
View Code? Open in Web Editor NEWNow witness my Final ORM! Node ORM for ArangoDB. Moved: https://gitlab.com/NoahGray/final-orm
Home Page: https://gitlab.com/NoahGray/final-orm
Now witness my Final ORM! Node ORM for ArangoDB. Moved: https://gitlab.com/NoahGray/final-orm
Home Page: https://gitlab.com/NoahGray/final-orm
When doing
const collection = await MyModel._collection // returns null
it seems to always return null the first time. Running the function again will work properly. I guess it is not initialized full. Maybe a constructor is needed to fix this.
Hi again!
I currently have the situation where I have a user ID and I want to delete that user from the database. I have the following two questions:
const user = User.get(_id);
user.remove();
This will result in two database queries, right? Is there another way to do it in just one query, f.e. User.remove(_id);
?
Model.remove(model)
or
Model.prototype.remove()
it only changes the removed flag from false to true. Is there a way to hard delete the user from the database as well?
Thanks in advance!
Best regards,
jinxcifer
This package is MIT licensed, originally licensed from @MegaUITeam.
export default class User extends Model {
static schema = {
name: String,
email: String,
password: String,
role: { $type: String, enum: ['ADMIN', 'USER'], default: 'USER' },
Also, perhaps there needs to be some consistency with the naming of options. $
before or not?
When trying to connect to arangoDB with specified host (besides 'localhost'), it always return this error
Error: getaddrinfo ENOTFOUND user_name user_name:80
I already specified all information needed but it seemed override the configuration parameters I specified.
Hi,
I am using the following function:
User.findOne({where: {email: email, username: username}})
With this query, I get the first user which has the specified email AND username (if there is one), right? Is it also possible to specify that I want to get the first user who has the specified email OR username? If it's possible, what do I have to pass as parameter?
Thanks in advance!
Best regards,
Jinxcifer
This code does not seem to work as intended:
static async _getCollection () {
if (this._collection) { // always seems to be true
return this._collection
}
const db = await this._getDatabase()
const collection = db.collection(this.name)
try {
await collection.create()
await this._setIndexes(collection)
} catch (e) {
}
return this._collection = collection
}
static async _setIndexes (collection) {
const schema = this._getSchema()
for (const field of schema) {
if (!field.options.index) continue
const path = field.path.join('.')
const unique = field.options.unique
await collection.createHashIndex(path, {unique})
}
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.