fireboost icon indicating copy to clipboard operation
fireboost copied to clipboard

Firestore Collection renameFieldDocs returns Something Went Wrong error

Open isab opened this issue 3 years ago • 1 comments

Code:

const { FireBoost } = require('fireboost');
const firestore = admin.firestore();
const admin = require('firebase-admin');
const certs = require('../certs.json');
admin.initializeApp({
  credential: admin.credential.cert(certs),
  databaseURL: 'https://blah.firebaseio.com',
});

function renameData() {
  const fireBoost = new FireBoost().firestore();
  const colRef = firestore.collection('Ventures');
  const utilColRef = fireBoost.ref(colRef);
  utilColRef.renameFieldDocs({ cover_image_url: 'coverImageUrl' });
}
renameData();

I'm trying to rename an attribute in all the documents in one of my collections. For some reason it keeps giving me a Something Went Wrong error. After checking the source code in this repo it seems like the error is because of this code here https://github.com/39ro/fireboost/blob/master/src/firestore.ts#L153. I double checked the type of colRef and verified that it is returning a CollectionReference. So I'm not sure why this is happening.

Any help here would be appreciated.

isab avatar Apr 07 '21 05:04 isab

I also see this error when I try to rename a field in the docs of a collection. I use mostly the same code as above. Also fails for attempting to rename a field in a single document.

DerKO9 avatar Apr 21 '21 02:04 DerKO9