Closed gvaidees closed 9 years ago
You cannot write a mix of bitemporal and non-bitemporal documents.
In fact, to write bitemporal documents, you must specify the temporalCollection as a peer parameter of the documents parameter because it applies to every document. You do not specify temporalCollection as a peer of the collections parameters, which can be different for different documents. In other words, temporalCollection is similar to the txid parameter and not similar to the permissions parameter.
Oh ok. I patterned it after bulk write of non-temporal documents that seem to support different collections for different documents in the bulk payload, such as -
db.documents.write({
uri: docuri,
collections: ['coll0', 'coll1'],
contentType: 'application/json',
quality: 10,
permissions: [
{'role-name':'app-user', capabilities:['read']},
{'role-name':'app-builder', capabilities:['read', 'update']}
],
properties: {prop1:'foo', prop2:25},
content: {id:12, name:'Jason'}
}, {
uri: docuri2,
collections: ['coll0', 'coll1'],
contentType: 'application/json',
quality: 10,
permissions: [
{'role-name':'app-user', capabilities:['read']},
{'role-name':'app-builder', capabilities:['read', 'update']}
],
properties: {prop1:'bar', prop2:33},
content: {id:245, name:'Paul'}
})
I see that bulk write with following payload worked.
{
documents: [
{
uri: docuri,
collections: ['coll0', 'coll1'],
contentType: 'application/json',
quality: 10,
permissions: [
{'role-name':'app-user', capabilities:['read']},
{'role-name':'app-builder', capabilities:['read', 'update']}
],
properties: {prop1:'foo', prop2:25},
content: {
'System': {
'systemStartTime' : "",
'systemEndTime' : "",
},
'Valid': {
'validStartTime': "2001-01-01T00:00:00",
'validEndTime': "2011-12-31T23:59:59"
},
'Address': "999 Skyway Park",
'uri': "javaSingleDoc1.json",
id: 12,
name: 'Jason'
}
},
{
uri: docuri2,
collections: ['coll0', 'coll1'],
contentType: 'application/json',
quality: 10,
permissions: [
{'role-name':'app-user', capabilities:['read']},
{'role-name':'app-builder', capabilities:['read', 'update']}
],
properties: {prop1:'foo', prop2:50},
content: {
'System': {
'systemStartTime' : "",
'systemEndTime' : "",
},
'Valid': {
'validStartTime': "2001-01-01T00:00:00",
'validEndTime': "2011-12-31T23:59:59"
},
'Address': "888 Skyway Park",
'uri': "javaSingleDoc2.json",
id: 12,
name: 'Bourne'
}
}
], temporalCollection: 'temporalCollection'}
Yes, that's the expected approach. See the functional specification for more.
closing because shipped
Code above inserts 2 documents, one temporal and one non-temporal results in both documents being inserted as non-temporal. I see that both documents are ingested as non-temporal. I see the same issue when I insert 2 documents and pass in temporalCollection property for each one of them