Below the insert Script
This query returns two documents
db.getCollection('test').find({
'status': 'current'
,$or: [
{'identifier': {$elemMatch:
{'system': 'urn:ihe:iti:xds:2013:accession', 'value': '1'}
}}
],
$or: [
{'patientId.value': {$in: [
'693561'
]}}
]
, 'type.coding.code': 'master'
})
Whereas
this query returns only one document
db.getCollection('test').find({
$or: [
{'patientId.value': {$in: [
'693561'
]}}
],
'status': 'current'
,$or: [
{'identifier': {$elemMatch:
{'system': 'urn:ihe:iti:xds:2013:accession', 'value': '1'}
}}
]
, 'type.coding.code': 'master'
})
Where is my mistake ?
Thanks a lot
*INSERT SCRIPT:
*
db.getCollection('test').insert({
"status" : "current",
"identifier" : [
{
"use" : "temp",
"system" : "[http://www.bmc.nl/zorgportal/identifiers/encounters]",
"value" : "Encounter_Roel_20130404"
}
],
"type" : [
{
"coding" : [
{
"system" : "[http://snomed.info/sct]",
"code" : "11429006",
"display" : "Master 123A"
}
,
{
"system" : "[http://hl7.org/fhir/encounter-type]",
"code" : "master",
"display" : "master"
}
]
}
],
"patientId" :
{
"value" : "693561"
}
}
);
db.getCollection('test').insert({
"status" : "current",
"patientId" :
{
"value" : "693561"
}
,
"identifier" : [
{
"use" : "temp",
"system" : "urn:ihe:iti:xds:2013:accession",
"value" : "1"
}
],
"type" : [
{
"coding" : [
{
"system" : "[http://snomed.info/sct]",
"code" : "11429006",
"display" : "Consultation"
}
,
{
"system" : "[http://hl7.org/fhir/encounter-type]",
"code" : "master",
"display" : "master"
}
]
}
]
}
);