Cool! Thanks for the quick fix. Your workaround also worked a charm btw, it's running in production now ;)
Thanks for the alternative, I'll give that a try soon.
According to the docs for destroy it is possible to pass universal options to the destroy
function. So Itried passing {document: true}
to enable document handling for my destroy call:
const collection = 'myTableName';
database[collection]
.destroy({'date <': '2019-10-01', 'status': 'O'}, {document: true})
.catch(/* error handling here */);
But that gets me error: column date does not exist
I also tried it wihtout the {document: true}
but it gives the same result.
It is not entirely clear to me how I can use destroy
in conjunction with a document table and there doesn't seem to be a destroyDoc
function available. Is there any way to destroy items in a document table based on a query object? How should I go about this?
I am using node 12, Massivejs 6.1.0 and Postgres 11.
I like the way massive makes working with documents very easy and takes the mapping of the body and id out of the equation as developer. However, I would not want to map out these properties myself every time I get an array of results. So: is there an option I can/could set when saving or querying documents so that the created_at and updated_at properties are either not in the document table or not part of the document body result?
When you write about adapting the creation script, what exactly do you mean? Can I override it and place it somewhere in my project so that Massive will use my version?
As for why we don't want the xxx_at
fields:
Our data comes from an external system and we just copy it over to serve it to a frontend.
The external system has its own auditing fields and ids with different names, so those already get stored in the body
column as part of the json. So when we copy over and further on use the data we don't need the xxx_at
columns and would prefer to just not have them at all.
I think it would be a good addition to be able to be able to give a audit: false
or meta: false
option when writing or reading docs to exclude the columns if you don't need/want them. Oftentimes they're not important from a developer or functional standpoint. Or sometimes you do need/want them but under a different name that you want to determine yourself.
I like the way massive makes working with documents very easy and takes the mapping of the body and id out of the equation as developer. However, I would not want to map out these properties myself every time I get an array of results. So: is there an option I can/could set when saving or querying documents so that the created_at and updated_at properties are either not in the document table or not part of the document body result?