Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to update nested fields with custome mask in updateDocument() #146

Open
zhezhang77 opened this issue Nov 9, 2022 · 0 comments · May be fixed by #148
Open

Unable to update nested fields with custome mask in updateDocument() #146

zhezhang77 opened this issue Nov 9, 2022 · 0 comments · May be fixed by #148
Labels

Comments

@zhezhang77
Copy link

The custom mask is interpreted as a whole field name instead of the nested field name.
Therefore there is no way to update a nested field with it.

Minimal code to reproduce the problem

const firestore = FirestoreApp.getFirestore(email, key, projected);

const original = {
    field1: 'value1',
    field2: 'value2',
  
    field3: {
        field4: 'value4',
        field5: 'value5',
    },

    'field3.field4': 'value3.4',
}

const update = {    
    field3: {
        field4: 'new value4',
    },
    'field3.field4': 'new value3.4',
}

firestore.createDocument('TestCol/TestDoc', original);
var updated = firestore.updateDocument('TestCol/TestDoc', update, ['field3.field4']);

Expected Behavior

updated = {
    field1: 'value1',
    field2: 'value2',
    
    field3: {
        field4: 'new value4',  //<-- Updated
        field5: 'value5',
    }

    'field3.field4': 'value3.4',
}

Actual Results

updated = {
    field1: 'value1',
    field2: 'value2',
    
    field3: {
        field4: 'value4',
        field5: 'value5',
    }

    'field3.field4': 'new value3.4',  //<-- Updated
}
Library Version: Head
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant