The Sequelize library provides easy access to a MySQL database by mapping database entries to objects and vice versa. To put it in a nutshell... it's an ORM (Object-Relational-Mapper). The library is written entirely in JavaScript and can be used in the Node.JS environment.
0
votes
1answer
11 views
How do I add a lot of data to Sequelize model?
I have many .txt files where each line has some data that I want to add to a model, so that it can be ready for querying. The problem is that none of the "insert" queries are being executed, probably ...
0
votes
0answers
11 views
Everyuath with sequelize
I have problem with Everyauth module and sequelize module. For example: when I want check email exist in db (in validateRegistration), first return value in validateRegistration and then execute ...
0
votes
0answers
23 views
Get last inserted id Sequelize
I'm using Sequelize and I'm trying to get the last inserted ID in raw query.
My query is
.query(Sequelize.Utils.format(["insert into MyTable (field1, field2) values (?,?)", val1, val2])
The query ...
0
votes
0answers
23 views
CompoundJS and JugglingDB error with the database
I tried to create my first app using CompoundJS and MySQL. So I created a database named "Lys-Armony_dev" in my local database server and I executed the following commands:
compound init Lys-Armony ...
0
votes
0answers
54 views
Multiple One to many relations modelling
I have 2 models both of which have a relation to the users table i.e. project users has a foreign key to users, and comments also belong to users
for project users model (projectusers.js file):
var ...
0
votes
1answer
47 views
How do I return the results of a query using Sequelize and Javascript?
I'm new at javascript and I've hit a wall hard here. I don't even think this is a Sequelize question and probably more so about javascript behavior.
I have this code:
...
1
vote
2answers
61 views
Why I cannot add field to a JS object?
I'm programming Node with Sequelize ORM for MySQL. I need to add a new field to the object that Sequelize returns on a query, but it doesn't seems to work.
Category.find({
where: { id: ...
0
votes
0answers
42 views
sequelize.js custom validator, check for unique username / password
Imagine I have defined the following custom validator function:
isUnique: function () { // This works as expected
throw new Error({error:[{message:'Email address already in use!'}]});
}
However, ...
1
vote
1answer
51 views
sequelize.js relationship validation
Imagine I have two models:
var Movie = sequelize.define('movies', {
/* model definition */
})
var Genre = sequelize.define('genres', {
/* model definition */
});
Movie.hasMany(Genre);
...
0
votes
2answers
40 views
Cleaning out test database before running tests
What is the best way to clean out a database before running a test suite (is there a npm library or recommended method of doing this).
I know about the before() function.
I'm using node/express, ...
0
votes
1answer
31 views
Sequelize appears to be updating every associated record on add?
It appears that when I use the addSomething function to create an additional association, Sequelize updates every existing association marking the associated id field NULL, then REupdates every one of ...
0
votes
1answer
52 views
Testing node server with mocha and nested callbacks
I'm learning node and mocha and have the test below (production code increments a field in the database).
To see if its working, I'm outputting the value of this field before and after a call to ...
1
vote
1answer
33 views
How do I define Sequelize.STRING length?
I want to define a length of a datatype in sequelize.
There is my source code :
var Profile = sequelize.define('profile', {
public_id: Sequelize.STRING,
label: Sequelize.STRING
})
It create a ...
0
votes
1answer
60 views
Saving object with Sequelize
I am struggling with step 1 of Sequelize. I have read through the tutorial and I must be missing on something basic, for I have already spent over a day trying to figure out what I am doing wrong.
...
0
votes
2answers
84 views
Eagerly Loaded Associations on sequelize
I have the following entities:
var Group = sequelize.define("Group", { name: Sequelize.STRING });
var Course = sequelize.define("Course", { name: Sequelize.STRING });
var GroupHasCourse = ...