問題タブ [jugglingdb]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
javascript - nodejs jugglingdb belongsTo と hasMany 既存の db オブジェクトとの関係
jugglingdb は、リレーショナル データベースを作成する 2 つの関数を公開します。
私は今、これを日常の開発でどのように使用できるかを自問しています。
belongsTo と hasMany はオブジェクトに関数を追加していますが、既存のオブジェクト間の関係を作成する方法がないように見えますか?
例については、http : //compoundjs.com/juggling.html#hasMany を参照してください。
オブジェクトを作成するのではなく、既存のオブジェクト間のリンクを作成したいのですが、どのように機能しますか?
多分私は関数を誤解しているだけですか?
楽しんで
ジャシャ
追伸: 担当者が 1500 人以上いる人が jugglingdb タグを作成してこの質問に追加してくれたら素晴らしいと思いませんか? しかし、それが十分に関連しているかどうかは本当に言えません。
node.js - 化合物を使用して、validatesPresenceOf を使用すると更新時にエラーが発生しました
Compoundとmongodbでアプリを作成しています。複合使用 jugglingdb と jugglingdb-mongodb を使用して、mongodb に接続します。
コンパウンドの足場を使用してクライアントのクラッドを生成しました。次に、Client.validatesPresenceOf('name');
app/models/client.js に追加しました
作成時には機能しますが、更新時には失敗します。
また、検証を db/schema.js に追加しようとしましたが、同じエラーが発生しました。
これは私が得たエラーです
/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/server.js:529 エラーをスローします。^ エラー: 送信後にヘッダーを設定できません。ServerResponse.OutgoingMessage.setHeader (http.js:708:11) で ServerResponse.res.setHeader (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/node_modules/connect/lib/patch.js:59) で:22) ServerResponse.res.set.res.header (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/lib/response.js:518:10) で ServerResponse.res.location (/Users /camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/lib/response.js:649:8) ServerResponse.res.redirect (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/express/lib) で/response.js:691: コード ((/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/compound/node_modules/kontroller/lib/base.js:157:17)、:84:9 で評価) ModelConstructor で。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/model.js:827:33) ModelConstructor.next (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/) lib/hooks.js:48:18) ModelConstructor で。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/model.js:826:38) ModelConstructor.next (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/ lib/hooks.js:48:18) /Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb/lib/model.js:825:30 で /Users/camilo/Documents/Pruebas/Nodejs/interno2 /node_modules/jugglingdb-mongodb/lib/mongodb.js:249: /Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/collection.js:703:14 で 9 null。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/db.js:1709:18) g (events.js:175:14) at EventEmitter. Server.Base._callHandler (/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/base.js:) で (events.js:106:17) を発行します。 130:25) /Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/server.js:464:24 で MongoReply.parseBody (/Users/camilo) /Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/responses/mongo_reply.js: 132:5) null で。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/server.js:410:22) EventEmitter.emit (events.js:95:17) ) null で。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:190:13) EventEmitter.emit (events.js:98:17) ) ソケットで。(/Users/camilo/Documents/Pruebas/Nodejs/interno2/node_modules/jugglingdb-mongodb/node_modules/mongodb/lib/mongodb/connection/connection.js:382:22) Socket.EventEmitter.emit (events.js:95) :17) ソケットで。(_stream_readable.js:699:14) で Socket.EventEmitter.emit (events.js:92:17) で、emitReadable_ (_stream_readable.js:382:10) で
バージョン:
- nodejs: 0.10.1
- 複合js: 1.1.5-21
- ジャブリングデータベース: 0.2.0-27
- jugglingdb-mongodb: 0.0.4-1
node.js - 複合 JS リレーションシップ アクセス
以下のように 2 つのスキーマ オブジェクトを定義しました (mongodb で使用するため)。
しかし、関連するメッセージ オブジェクトにアクセスできません。
メッセージ コレクションに新しいメッセージが追加されているにもかかわらず、メッセージの配列は常に空です。
mongo シェルを実行したところ、期待どおりにメッセージが表示されたので、mongo アダプターdb.Message.find({userId:'517240bedd994bef27000001'})
に問題があるのではないかと考え始めています。
CompoundJS の 1対多の関係も同様の問題を示しています (と思います)。
ドキュメントから解決できる限り、これはうまくいくはずです。私は何を間違っていますか?
編集:
Anatoliy の提案に従ってスキーマに変更を適用した後、mongo データベースを削除して npm を更新しましたが、新しいユーザーを作成しようとすると、次のようになりました。
EDIT2: アクションを作成:
node.js - "describe" と "schema.define" の違いは何ですか?
CompoundJS の世界を進んでいくうちに、スキーマを定義する 2 つの方法に出会いました。
初め:
2番:
最初のものは機能しますが、古いデザインのように見えます。2 つ目は機能しませんが、JugglingDB のドキュメントによると、この方法で実行できます。
どちらを使用する必要がありますか? 2番目のものがうまくいかないのはなぜですか?
更新: これは、2番目のものを使用したときに発生するエラーです:
javascript - オブジェクトはCoffeescriptで不変ですか?
問題は、色が変更されているが、シートが追加されていないことです。私がするとき、typeof car
それは戻りますobject
。何か案は?
mysql - JugglingDBで任意のmySQLクエリを使用していますか?
私は現在、ORM用のNodeJSでジャグリングdbを使用しています。ここで、SUM と GROUP BY を使用して任意の SQL を使用して複数のテーブルのデータを結合することを含む、いくつかのレポートを作成する必要があります。jugglingdb フレームワークを使用してこれを行うにはどうすればよいでしょうか。複数の列からのデータを含むオブジェクトのリストを取得するにはどうすればよいでしょうか。