ノードを持つジョブボードの作成オブジェクトのネストされた配列を挿入する
ノードを持つジョブボードの作成JSとFaunadb -パート1
ルリスフェリペ・ Dec 6 ' 20・ 5分読む
ノードを持つジョブボードの作成JSとFaunadb -パート2
ルリスフェリペ・ Dec 8 ' 20・ 5分読む
ノードを持つジョブボードの作成JSとFaunadb -パート3
ルリスフェリペ・ Dec 9 ' 20・ 4分読む
導入
私は最終的に私はこれらのポストの開始から、私は前のものよりも複雑にする必要があります候補者の開始からの場所になった
ここで、私は定期的なリレーショナルデータベースの中で結合と挿入参照をどのようにするかを学ぶ必要があります.しかし、これがNOSQLであるので、それらのN = NテーブルをIDだけで作成する代わりに、私はオブジェクトの中で参照の配列を持っています.
内容
* Candidate Module :
モジュール構造の作成
* Insert Candidate :
候補のスキルのためのバルク挿入機能を作成し、収集し、これらのスキルのための参照を候補オブジェクトに挿入します
候補モジュール
First thing, I will copy another module's folder and add a reference in the root's route.js for this module.
Then I will proceed to change all the names to candidates and remove the content for the functions.
The URL for this module will be: "http:localhost:3000/candidates";
候補候補
Normally, I would start a module by creating a list, but not this time, I will delete the document there is already in the database and proceed to create new documents.
I want the request for a candidate to have an array of skill names, then I will check for those names in the skills table and insert the ones that do not exist.
After that, I will insert the user in the database with an array of references for the skills he has and the level of each skill.
I will be using this object from my first post of this series as an input:
{
"name": "fake candidate",
"email": "[email protected]",
"bio": "was literally just created",
"social_media": [
{
"name": "twitter",
"link": "https://twitter.com/fake_candidate"
}
],
"skills": [
{
"name":"AWS",
"experience": "advanced"
},
{
"name":"Azure",
"experience": "advanced"
}
]
}
When I send this, my function should insert both AWS and Azure in the skill table return their reference and replace the name in these objects for it;
So the first function that I will use in this module will actually be in the skills module, I will create this "bulk insert" function there, as it sounds like it belongs in the skills domain more than in the candidates.
この機能については、最初に、データベース上のものから新しいスキルを分離して、その後、新しいスキルを挿入し、両方を返す.
今、私は各スキルのための参照を持っている、私は見回してthis StackOverflow question ドキュメントをこのテーブルに挿入する方法を説明します.
著者は、私たちがおそらく、IDの代わりに参照クエリ全体を格納するべきであると答えています.
私は、そのスキルの経験レベルと一緒にクエリを格納している、これは候補オブジェクトのスキル配列の最終的な外観である必要があります.
私は、私が他のモデルのためにしたように候補オブジェクトのために妥当性検査を作成して、挿入候補機能をテストするために進みます.
これは仕事をしました.これはデータベースのように見えるものです.
このリクエストに対する返答は膨大ですが、次のポストでそれに取り組みます.
結論
Fanunadbについての良い部分は、それが表示され始めています.
私は本当にこのモジュールを終えて、これを候補リストのために結合させることに興奮しています
このプロジェクトのリポジトリ
チャオチェッタ / ファウンジャ
Reference
この問題について(ノードを持つジョブボードの作成オブジェクトのネストされた配列を挿入する), 我々は、より多くの情報をここで見つけました https://dev.to/ciochetta/creating-a-job-board-with-node-js-and-faunadb-part-4-inserting-nested-arrays-of-objects-3hheテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol