当前位置:网站首页>Ravendb starts -- document metadata
Ravendb starts -- document metadata
2022-07-06 21:06:00 【Uncle meow】
We can store any data content in the document , For example, in the order document, we will store the order status 、 Order item quantity 、 Order amount and so on . But we also need to store some content unrelated to the order document , For example, who modified the order document 、 When did you modify the order document , It's time to Document Metadata ( Document metadata , Let's translate it like this for the time being ) Debut .
Metadata What is stored by default
Metadata The storage format of is the same as the document itself Json,RavenDB Use Metadata Store several important information about tracking documents :
- Collection name , Stored in @collection in , How can this attribute determine which set the data document is stored in , If this value is not set , Data documents will be stored in @empty Collection ;
- Last modification date of the document , Stored in @last-modified Properties of the , When storing format UTC;
- Client type , This is a Key , We can go through this Key Know the type of client , Common types are shown in the following table :
type | explain |
---|---|
Raven-Clr-Type | .NET client |
Raven-Java-Class | Java client |
Raven-Python-Class | Python client |
Customize Metadata Property naming conventions
Besides using RavenDB Built in Metadata In addition to attributes, we can also customize Metadata attribute , For example, we need to record who last modified the order document , Then we can customize Metadata attribute Last-Modified-By-User, The code is as follows :
using Raven.Client.Documents; var store = new DocumentStore { Urls = new[] { "http://localhost:8080" }, Database = "Tasks" }; store.Initialize(); using (var session = store.OpenSession()) { var order = session.Load<Order>("orders/1-A"); // The server will not be requested again , Because when we query data documents , //Metadata It will also be returned to the client together var metadata = session.Advanced.GetMetadataFor(order); metadata["Last-Modified-By-User"] = " Zhang San "; session.SaveChanges(); }
We are RavenDB Studio View in orders/1-A The data content , We can see the custom one Metdata Attribute already exists with Metadata The node is down , Here's the picture .
Generally speaking, we seldom use this form to operate in actual development Metadata , We will use events to operate , This will be explained in detail in the later column , Here you only need to know what we are talking about now .
TIP: When we're in RavenDB See in the document with @ At the beginning Metadata Attribute , It means that this attribute is RavenDB Reserved for your own use , So we are expanding Metadata You can't use the same attribute name when using attributes , We customize Metadata Attributes need to follow Pascal nomenclature (PascalCase) perhaps Pascal-Case Nomenclature ( The words that make up the attribute name are capitalized , Use... Between words - Division of no. ), Of course, you can also not follow this suggestion .
边栏推荐
- 20220211 failure - maximum amount of data supported by mongodb
- Common English vocabulary that every programmer must master (recommended Collection)
- Reference frame generation based on deep learning
- ICML 2022 | flowformer: task generic linear complexity transformer
- What is the difference between procedural SQL and C language in defining variables
- New database, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, Feishu multidimensional table, heipayun, Zhixin information, YuQue
- The most comprehensive new database in the whole network, multidimensional table platform inventory note, flowus, airtable, seatable, Vig table Vika, flying Book Multidimensional table, heipayun, Zhix
- Introduction to the use of SAP Fiori application index tool and SAP Fiori tools
- What are RDB and AOF
- 数据湖(八):Iceberg数据存储格式
猜你喜欢
Common English vocabulary that every programmer must master (recommended Collection)
[MySQL] basic use of cursor
3D人脸重建:从基础知识到识别/重建方法!
PHP online examination system version 4.0 source code computer + mobile terminal
Entity alignment two of knowledge map
Pinduoduo lost the lawsuit, and the case of bargain price difference of 0.9% was sentenced; Wechat internal test, the same mobile phone number can register two account functions; 2022 fields Awards an
OneNote 深度评测:使用资源、插件、模版
强化学习-学习笔记5 | AlphaGo
Laravel笔记-自定义登录中新增登录5次失败锁账户功能(提高系统安全性)
Deployment of external server area and dual machine hot standby of firewall Foundation
随机推荐
Pinduoduo lost the lawsuit, and the case of bargain price difference of 0.9% was sentenced; Wechat internal test, the same mobile phone number can register two account functions; 2022 fields Awards an
Interviewer: what is the internal implementation of ordered collection in redis?
[wechat applet] operation mechanism and update mechanism
Can novices speculate in stocks for 200 yuan? Is the securities account given by qiniu safe?
use. Net drives the OLED display of Jetson nano
Pat 1085 perfect sequence (25 points) perfect sequence
【论文解读】用于白内障分级/分类的机器学习技术
ICML 2022 | flowformer: task generic linear complexity transformer
el-table表格——获取单击的是第几行和第几列 & 表格排序之el-table与sort-change、el-table-column与sort-method & 清除排序-clearSort
2022 fields Award Announced! The first Korean Xu Long'er was on the list, and four post-80s women won the prize. Ukrainian female mathematicians became the only two women to win the prize in history
Aiko ai Frontier promotion (7.6)
防火墙基础之外网服务器区部署和双机热备
Simple continuous viewing PTA
PG basics -- Logical Structure Management (transaction)
C language operators
HMS Core 机器学习服务打造同传翻译新“声”态,AI让国际交流更顺畅
愛可可AI前沿推介(7.6)
Web开发小妙招:巧用ThreadLocal规避层层传值
##无yum源安装spug监控
3D face reconstruction: from basic knowledge to recognition / reconstruction methods!