You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
how you use "add" method if your code on nodejs not allow "import sentence" in my case I am using require to use collection, add, set, update methods but it didn't work
Error displayed App listening on port 3000 test_project-test_project-1 | /firestore/test_project/index.js:49 test_project-test_project-1 | await add(metadatas,doc) test_project-test_project-1 | TypeError: add is not a function test_project-test_project-1 | at /firestore/test_project/index.js:49:11
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
how you use "add" method if your code on nodejs not allow "import sentence" in my case I am using require to use collection, add, set, update methods but it didn't work
`
const firestore = require("firebase/firestore")
const { collection, add } = require("typesaurus")
const admin = require("firebase-admin")
const { MOCK_MODELS } = require("./mock");
const { Metadata } = require("./cpr_models/metadata.js");
const port = 3000;
const PROJECT_ID = "dummy-project-id" // este id se encuentra en la service account de firebase
admin.initializeApp({
credential: admin.credential.applicationDefault(),
projectId: PROJECT_ID,
databaseURL: "https://${PROJECT_ID}.firebaseio.com"
});
const metadatas = collection('metadatas')
MOCK_MODELS.forEach(async doc => {
await add(metadatas,doc)
// await Typesaurus.add(metadatas,doc)
// await Typesaurus.schema.apply("add",[metadatas,doc])
// await Typesaurus.schema.add(metadatas,doc)
});
`
Error displayed
App listening on port 3000 test_project-test_project-1 | /firestore/test_project/index.js:49 test_project-test_project-1 | await add(metadatas,doc) test_project-test_project-1 | TypeError: add is not a function test_project-test_project-1 | at /firestore/test_project/index.js:49:11
I hope that you can help me please.
Beta Was this translation helpful? Give feedback.
All reactions