dyaa / loopback-connector-firestore Goto Github PK
View Code? Open in Web Editor NEWFirebase Firestore connector for the LoopBack framework.
License: MIT License
Firebase Firestore connector for the LoopBack framework.
License: MIT License
Hi! Thanks for that good connector.
There's an issue on posting an instance of a model that contains a GeoPoint property. Example:
{
"name": "string",
"capacity": 0,
"description": "string",
"location": {
"lat": 0,
"lng": 0
}
}
Posting this exact data parameter on the Post request results in this 500 code error:
{
"error": {
"statusCode": 500,
"name": "Error",
"message": "Cannot encode type ([object Object]) to a Firestore Value",
"stack": "Error: Cannot encode type ([object Object]) to a Firestore Value\n at Function.encodeValue (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/@google-cloud/firestore/src/document.js:672:11)\n at Function.encodeFields (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/@google-cloud/firestore/src/document.js:544:36)\n at WriteBatch.set (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/@google-cloud/firestore/src/write-batch.js:257:35)\n at DocumentReference.set (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/@google-cloud/firestore/src/reference.js:416:8)\n at CollectionReference.add (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/@google-cloud/firestore/src/reference.js:1830:24)\n at Firestore.create (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-connector-firestore/lib/firestore.js:61:29)\n at invokeConnectorMethod (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/dao.js:169:21)\n at /Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/dao.js:472:11\n at doNotify (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at doNotify (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/observer.js:155:49)\n at Function.ObserverMixin._notifyBaseObservers (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/observer.js:178:5)\n at Function.ObserverMixin.notifyObserversOf (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)\n at Function.ObserverMixin._notifyBaseObservers (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/observer.js:176:15)\n at Function.ObserverMixin.notifyObserversOf (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/observer.js:153:8)"
}
}
Another error by changing lat
to latitude
and lng
to longitude
in the data parameter:
{
"error": {
"statusCode": 500,
"name": "AssertionError",
"message": "lat must be a number when creating a GeoPoint",
"actual": false,
"expected": true,
"operator": "==",
"generatedMessage": false,
"stack": "AssertionError: lat must be a number when creating a GeoPoint\n at new GeoPoint (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/geo.js:198:3)\n at GeoPoint (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/geo.js:166:12)\n at ModelConstructor.set [as location] (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/model-builder.js:606:81)\n at ModelConstructor.ModelBaseClass._initProperties (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/model.js:202:17)\n at ModelConstructor.ModelBaseClass (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/model.js:60:8)\n at ModelConstructor (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/model-builder.js:196:22)\n at ModelConstructor (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/model-builder.js:196:22)\n at new ModelConstructor (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/model-builder.js:196:22)\n at Function.DataAccessObject.create (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-datasource-juggler/lib/dao.js:359:13)\n at SharedMethod.invoke (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/strong-remoting/lib/shared-method.js:270:25)\n at HttpContext.invoke (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/strong-remoting/lib/http-context.js:297:12)\n at phaseInvoke (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/strong-remoting/lib/remote-objects.js:677:9)\n at runHandler (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-phase/lib/phase.js:135:5)\n at iterate (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-phase/node_modules/async/lib/async.js:146:13)\n at Object.async.eachSeries (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-phase/node_modules/async/lib/async.js:162:9)\n at runHandlers (/Users/thomaslecoeur/Projets/Pijam/pijam-proto-api/node_modules/loopback-phase/lib/phase.js:144:13)"
}
}
Using "loopback-connector-firestore": "^1.0.5"
and "loopback": "^3.0.0"
how do i get related data from other models while writing remote method inside another model..?
🚨 You need to enable Continuous Integration on all branches of this repository. 🚨
To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.
Since we did not receive a CI status on the greenkeeper/initial
branch, we assume that you still need to configure it.
If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/
.
We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.
Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial
branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organization’s settings page, under Installed GitHub Apps.
Can someone explain how to get/set/delete data from Firestore?
I tried this in my controller but it doesnt work:
@get('/firebase/doctors')
async getDoctor(
): Promise<any> {
return await this.doctorRepository.get('Doctor');
}
The loopback connector generates an AutoID while storing data to FireStore and we are unable to set the ID to our own value.
(Error: Cannot create data source "FireStore": Cannot initialize connector "loopback-connector-firebase": FIREBASE FATAL ERROR: Cannot parse Firebase url. Please use https://.firebaseio.com )
When you think the version 1.0.8 will be landed?
I need to use limit, skip and other filters and the previous version has not these functionality.
Thank you.
Does this connector support loopback 4 and latest firestore?
Hi, i started using this project with express js and firebase cloud functions to build an api.
Cloud functions environment provides a method to configure firestore easily:
admin.initializeApp(functions.config().firebase);
But this connector uses credentials auth. It would be a nice option to use firebase configuration
Connector returns an exception when trying to use the connector with built-in auth methods.
Hey man, theres a simple way to use the "include" loopback function to query relationed models?
If, theres no easy way, could you give me some references for I create that on this connector, that would be wonderfull.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.