简体   繁体   English

arangojs:keepNull 不是 collection.save 的选项?

[英]arangojs: keepNull not an option for collection.save?

I'm going through the documentation for arangojs and looking at the function collection.update() , keepNull is one of the options that can be added.我正在浏览 arangojs 的文档并查看 function collection.update() ,keepNull 是可以添加的选项之一。 https://github.com/arangodb/arangojs/blob/master/docs/Drivers/JS/Reference/Collection/DocumentManipulation.md https://github.com/arangodb/arangojs/blob/master/docs/Drivers/JS/Reference/Collection/DocumentManipulation.md

When going through the same documentation for the function collection.save() ( https://github.com/arangodb/arangojs/blob/master/docs/Drivers/JS/Reference/Collection/DocumentCollection.md ) we find no such option.在查看 function collection.save()的相同文档时( https://github.com/arangodb/arangojs/blob/master/docs/Drivers/JS/Reference/Collection/DocumentCollection.md ),我们没有发现这样的 optionCollection.md . Why?为什么? Do I first need to have an original file, then update that one with keepNull: false before I get it to clean up my documents from any null valued keys?我是否首先需要一个原始文件,然后使用 keepNull: false 更新该文件,然后才能从任何 null 值键中清理我的文档? Or is this a lack in the documentation?或者这是文档中的缺失? I think it's correct since I haven't managed to set keepNull to false using collection.save myself.我认为这是正确的,因为我自己没有设法使用 collection.save 将 keepNull 设置为 false。

The driver hands the query options over to the server, so this is the relevant documentation to look at:驱动程序将查询选项交给服务器,因此这是要查看的相关文档:

https://www.arangodb.com/docs/stable/http/document-working-with-documents.html#create-document https://www.arangodb.com/docs/stable/http/document-working-with-documents.html#create-document

The API does not support keepNull as option when creating a document. API 在创建文档时不支持keepNull作为选项。 It is only available for UPDATE/REPLACE queries to mark attributes for removal.它仅可用于 UPDATE/REPLACE 查询以标记要删除的属性。 So it's up to you to do this on the client-side.因此,由您在客户端执行此操作。 You may open a feature request nonetheless.尽管如此,您仍然可以提出功能请求。

BTW.顺便提一句。 In AQL, UPDATE doc WITH {} OPTIONS { keepNull: false } will not remove any attributes with a null value!在 AQL 中, UPDATE doc WITH {} OPTIONS { keepNull: false }不会删除任何具有null值的属性! It only removes attributes you set explicitly to null in the WITH {} part.它只会删除您在WITH {}部分中明确设置为null的属性。 This may apply to the driver as well.这也可能适用于驱动程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM