knex로 간단한 카운트를 시도하고 있습니다 (이후 to not be supported by bookshelf yet로 보임). 다음 코드는 작동 : bookshelf.knex('hosts').count('id').then(function(total) {
res.send({
meta: {
total: total[0]['coun
개인 프로젝트에서 Node.js + express + Bookshelf.js를 배우고 있습니다. 어디에서 쿼리를 작성합니까? 특히 다음 코드에서 'ORDER BY'또는 'WHERE'를 설정하는 방법은 무엇입니까? var Accounts = require('../collections/accounts').collection;
new Accounts().fe
어떻게 hasMany Space -> Accounts 관계를 정의 할 수 있습니까? var Space = Bookshelf.Model.extend({
tableName : 'spaces',
// Account variable does not exist :/
});
var Account = Bookshelf.Model.extend({
내 사용자 컨트롤러 var User = Bookshelf.Model.extend({
...
// verify the password
verifyPassword: function (password, hash, done) {
// Load hash from your password DB.
bcrypt.compare(password, ha
bookshelfjs를 사용하여 추가 할 수있는 Null 허용 열이 포함 된 조인 테이블에 레코드를 추가하고 싶습니다. 예를 들어, users 테이블과 accounts 테이블에는 accounts_users의 조인 테이블이 있습니다. var Account = Bookshelf.Model.extend({
tableName: 'accounts'
});