I have a basic view in CBL. The map function looks like this:
accounts_by_userid_view: {
"map": function(doc) {
if (doc.type === 'account') {
emit(doc.user_id, null);
}
}.toString()
}
An android, after making an update to a document in the view I notice that there are 2 versions indexed in the view. I believe in IOS the only version is the latest version of the doc. Is this expected?
FYI The content of the view after the update is this, notice 2 entries for document 1009643f57f453132900e1e476b64aa0, one at rev 26, and the other at 27:
{
total_rows: 0,
offset: 0,
rows: [
{
doc: {
authorised_instances: [
'38c3acb5-5a93-4102-8bd5-128da28102df'
],
_rev: '20-cfc322efb1acd02abab0c153e0c780d1',
verified_contact_methods: [
'other.testaccount@snowmonkey.co.uk'
],
archived_chat_groups: [],
_id: 'b424b402b574e4402d55b1d0511db309',
view_preferences: {
left_handed_view: false
},
owner: '3900241d-b43b-489f-84b1-c884c14a9d7a',
type: 'account',
emails: [],
user_id: '3900241d-b43b-489f-84b1-c884c14a9d7a',
friends: [
'ff39116b-5197-420c-8223-73284e4d1b65'
]
},
id: 'b424b402b574e4402d55b1d0511db309',
key: '3900241d-b43b-489f-84b1-c884c14a9d7a',
value: null
},
{
doc: {
authorised_instances: [
'6246c834-19da-4e93-a8a7-a9f4bb0d715d'
],
_rev: '27-2b9e4f925ef64c842336139f51079e4f',
verified_contact_methods: [
'testersonbob@gmail.com'
],
archived_chat_groups: [],
_id: '1009643f57f453132900e1e476b64aa0',
emails: [],
type: 'account',
owner: 'ff39116b-5197-420c-8223-73284e4d1b65',
view_preferences: {
left_handed_view: false
},
friends: [
'3900241d-b43b-489f-84b1-c884c14a9d7a'
],
user_id: 'ff39116b-5197-420c-8223-73284e4d1b65'
},
id: '1009643f57f453132900e1e476b64aa0',
key: 'ff39116b-5197-420c-8223-73284e4d1b65',
value: null
},
{
doc: {
authorised_instances: [
'6246c834-19da-4e93-a8a7-a9f4bb0d715d'
],
_rev: '26-511e5f516709e143dea2543bd98315ca',
verified_contact_methods: [
'testersonbob@gmail.com'
],
archived_chat_groups: [],
_id: '1009643f57f453132900e1e476b64aa0',
view_preferences: {
left_handed_view: true
},
owner: 'ff39116b-5197-420c-8223-73284e4d1b65',
type: 'account',
emails: [],
user_id: 'ff39116b-5197-420c-8223-73284e4d1b65',
friends: [
'3900241d-b43b-489f-84b1-c884c14a9d7a'
]
},
id: '1009643f57f453132900e1e476b64aa0',
key: 'ff39116b-5197-420c-8223-73284e4d1b65',
value: null
}
]
}
Here’s another example: