I'm using firebase and my users are set up like this:
{
"firebase-account-123": {
"users": {
"simplelogin:1": {
"properties"{ "name": "john doe", "email": "user#email.com" }
"children": {
"simplelogin:2":{ "name": "user 2", "email": "user2#email.com" },
}
},
"simplelogin:2": {
"properties"{ "name": "user 2", "email": "user2#email.com", "disabled": false }
}
}
}
I use simplelogin:X and the users email across many objects in my database. I know using this to identify my users across different objects is probably a bad move.
At some point I am trying to implement the ability to change emails which means that their simplelogin ID is going to have to change along with every email property that ever linked to their email.
Does anyone have any suggestions on how I can link users to one another without have to change their data if it changes across the entire platform? I'm thinking somewhere along the lines of a unique identifier for each users. I just don't know how I would implement this.
Related
I'm working on a ticket system, and I want to make a close ticket system, that will remove the ticket from the user, so I have my mongo array looking like this
{
"tickets": [{
"id": "cxZgqey2",
"subject": "fdgfdgdfgfdgfd",
"message": "gfdgfdgfdgdfg",
"ownerEmail": "soenmtherhg#gmail.com"
},
{
"id": "r4r-CnIC",
"subject": "dfdsfdsfsdfdsfdsf",
"message": "dsfdsfdfsdfdsfdsfdsfdsf",
"ownerEmail": "soenmtherhg#gmail.com"
}
]}
and I wanted to remove the entire object using only the id, how would I do this? (Using the npm module (not mongoose))
You can use the filter function in arrays and delete it passing the relevant id for that and also you can check loadash.
I am prototyping a Food Ordering app using Dialogflow(Chatbot maker) and got stuck with this problem. Technically, I want to persist the gathered data from an Intent after the user decided to "add more items to their order" and satisfies all the required parameters, which are, (itemName, quantity, [variants], [sauceType], ...).
The chat bot should be able to handle a request which consist of multiple items with their corresponding quantities but I am not sure if it's possible to model a data wherein it consist an array of Entities so, my first thought was to use a persistent Fulfillment using session-based Webhook with our custom Web Service, like for example: foodorder/api/order/123/items/add and 123 being the Session Id. But this approach requires more work and the generated model can be difficult to translate in Dialoflow Console.
The second solution comes into my mind, is to leverage the Intent property called Action and Parameters where we mark the Entity as List, but using this approach, the quantity doesn't get attached to the item itself.
My question is, how can I be able to model a data using Dialogflow that resembles something like below:
{
"givenName": "Dummy User",
"order": [
{
"itemName": "Burger",
"quantity": 2
},
{
"itemName": "6 piece Chicken Nuggets",
"quantity": 1,
"sauceType": "Tangy Barbeque"
},
{
"itemName": "Coke",
"quantity": 1,
"size": "Small"
}
]
}
Turns out what I was looking for was Composite Entities and mark it as a list.
The detailed answer can be found on this link:
https://stackoverflow.com/a/47166123/2304737
I know that if I simply try to get a list of my friends, it will only return app friends AKA friends who also have given permissions to Facebook
So, rightfully so, when I do a GET 'me/friends', I only see 5 friends.
However, when I do a GET me/posts/?fields=likes.fields(name), it obviously returns data with a list of friends who have liked my posts:
{
"id": "post1id",
"likes": {
"data": [
{
"name": "name1",
"id": "id1"
},
{
"name": "name2",
"id": "id2"
}....
]
}
It shows all friends, so non-app and app friends.
My question is, if all I want to use is my friends' names and id's from this result, would it be allowed, considering that some of these friends are not app-friends?
If you work the API with the user token, you may receive all likes (including friends who don't use the app, non-friends, friends who use the app, pages) but this is at all no indication for a users friends. Anyways you can utilize ALL data provided by the GraphAPI as long as you don't work around the limitations with something like exploiting the game invite feature.
Is it possible to, in 1 request, get the feed of a page but with the full event info?
As it is now, if a shared event is posted, you only get back the link to that event, no picture or title:
{
"id": "xxx",
"from": {
"category": "Community",
"name": "xxx",
"id": "xxx"
},
"story": "xxx shared xxx's event.",
"link": "https://www.facebook.com/events/xxx/",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/xxx/posts/xxx"
},
{
"name": "Like",
"link": "https://www.facebook.com/xxx/posts/xxx"
}
],
"privacy": {
"value": ""
},
"type": "link",
"status_type": "shared_story",
"application": {
"name": "Links",
"id": "xxx"
},
"created_time": "2013-06-19T10:05:50+0000",
"updated_time": "2013-06-19T10:05:50+0000",
"likes": {
"data": [
{
"name": "xxx",
"id": "xxx"
}
],
"count": 1
}
}
If I understand correctly, you need to retrieve the events but you want to do it all at once with the feed because you want to retrieve the information on the feed anyway.
Before doing that, you must know that the feed doesn't contain all the events.... Once created, a link to the event is automatically shared on the page feed. It is only a reference, which can then be hidden. The event won't be displayed on the feed anymore even if it still exists.
Requesting two different objects at the same time
So, the feed doesn't have the events information and the events and posts (feed) are stored on 2 different tables. Therefore, you need to get the events independently from the feed:
The feed /PAGE_ID/feed
The events /PAGE_ID/events
And, as you wanted, Graph API allows you to do this in only one request:
/PAGE_ID?fields=feed,events
Additional fields
Note that either feed or events accept the limit and fields parameters. For example, events can be specified by:
events.limit(100).fields(location,name,owner,description,updated_time,venue)
Possible fields are given in the doc.
There is no way to get the "full info" at once. You will have to specify each field in the request. So, don't get the "full info", but just the information you really need.
There is a post from Facebook addressing this scenario using multi-queries and FQL (Facebook Query Language). This will allow you to make multiple FQL calls in one request.
https://developers.facebook.com/docs/technical-guides/fql/#multi
Say I have several databases on my couch instance (in my case a user account database and login session database) The sessions have fields corresponding to a field in the user database. Is there a way to create a view, or make a call that encompasses this correlation, or would it just have to be done with an external script? To be more clear, here's an example.
Account db:
{
"_id": "78555fdfdd345debf427373f9dfaeca4",
...
"username" : "bob"
}
Sessions db:
{
"_id": "78555fdfdd345debf427373f9dfcd7ae",
..
"accountId": "78555fdfdd345debf427373f9dfaeca4",
"username": "bob"
}
Can I use emit or something like that to bundle together all this information in one call?
No, however a common workaround is to have a "type" attribute for documents.
For example...
Application db:
{
"_id": "account.78555fdfdd345debf427373f9dfaeca4",
"type": "account",
...
"username" : "bob"
}
{
"_id": "session.78555fdfdd345debf427373f9dfcd7ae",
"type": "session",
..
"accountId": "account.78555fdfdd345debf427373f9dfaeca4",
"username": "bob"
}
And then in your views:
map:
function (doc) {
if (doc.type=='account') {
# ...
}
}
No, unfortunately there is no way to connect data from multiple databases.
Each view is supposed to be self-contained, otherwise updating any document in 1 database will immediately need to trigger views indexes in every other database to be recalculated in all cases.