database - Create 2 documents when posting to CouchDB
问题描述
Is this possible? I'd like to normalize some data I'm storing in CouchDB, to take in one JSON object and, through designdocs, create multiple documents with different pieces of the data.
An example would be posting data about a book. I'd like to create a document for the book, check and see if there's any information about a publisher and if we have a document for that publisher, and if we don't, create a document for the publisher as well.
Does CouchDB have any functionality that would accomplish this? I know I could split up the data on the client, but I'd rather this logic be more centralized.
解决方案
You can post multiple docs at once with the bulk docs endpoint, but it doesn't contain any logic like you're describing. That must be done on the client.
推荐阅读
- c# - AppendText 在 C# 中获取命令和目标播放器
- java - Java GUI程序中如何计算文本区域中有多少单词
- ffmpeg - 使用 ffmpeg 使用 Alpha 通道将视频叠加在另一个视频之上
- jquery - 从表单域中删除单词的代码
- r - 数据帧之间的查找。如果匹配存在则返回计数、最大值和最小值
- r - R - 在 ggplot2 中强制 geom_density() 接受 df 列作为频率(y 变量)
- r - 从每行数据的最后一列获取数据
- android - 让按钮返回第二个微调器的字符串值
- sql - 使用表中的索引规范化数据
- nginx - 如何允许从 nginx 中的子域访问域?