Order by distance with documentDB api - geospatial

I'm trying to get the closest results (by distance) to a point on documentDB, something similar to $near in MongoDB.
I tried few variations but keep getting errors/ unsupported messages,
and I feel like I might be missing out the appropriate way.
I know that docDB also has a MongoDB API, is it somehow possible to query this API with $near while I'm using the documentDB API?

It seems that you are using Azure Cosmos DB: DocumentDB API and you’d like to query the closest/nearest results (by distance) to a point. As far as I know, it supports a number of built-in Spatial functions, but currently it does not support nearest.
This thread discussed a similar issue, and as Andrew Liu said, we could select the distance in the query and sort it either client-side or via a stored procedure to get the nearest point.
Besides, someone has gave a feature request, you could vote it.

Related

Pardot Visit query API - generic query not available

I am trying to extract/sync data through Pardot API v4 into a local DB. Most APIs were fine, just used the query method with created_after search criteria. But the Visit API does not seem to support neither a generic query of all visit data, nor a created_after search criteria to retrieve new items.
As far as I can see I can only query Visits in the context of a Visitor or a Prospect.
Any ideas why, and how could I implement synchronisation? (sorry, no access to Pardot DB...)
I have been using pypardot4 python wrapper for convenience but would be happy to use the API natively if it makes any difference.
I managed to get a response from Pardot support, and they have confirmed that such response filtering is not available on the Visits API. I asked for a feature request, but hardly any chance to get enough up-votes to be considered :(

How to avoid startup latency for Azure Table Storage/Cosmos DB Table API on .Net Core

Microsoft documentation here suggests to use await client.OpenAsync(); to avoid startup latency to Cosmos DB. This seems to be only applicable to SQL API. I try to use Table API and could not manage to do the same. My first request executes in 1500 ms and subsequent takes only 40, so that would be a very nice improvement.
I had tried both Microsoft.Azure.Cosmos.Table and Microsoft.WindowsAzure.Storage to connect, but did not find any way of doing that. The only thing I can think of is doing a "dummy" request that for sure does not return anything instead to achieve the same goal.
Is there any better way to initialize the connection?
A simple solution would be to query anything that you know exists.
Any call using the client will initialise the connection and do the (approximately) 8 requests that CosmosDB needs.
Reading the database account would be the simplest way to achieve this.

Cassandra/Scylla as graph database backen for JanusGraph and API exposed with GraphQl

I am looking for a Graph database using Scylla or Cassandra as the backend and then expose the web api as GraphQl.
Can you help me verify that I have got the followin stack right:
GraphQl or TinkerPop // Api schema, exposing api
JanusGraph(privious Titan) // Database layer facilitating grap structure
Cassasndra or Scylla
You've pretty much got it right though just to help clarify:
GraphQL is an abstraction designed to help make development/data access a bit simpler for developers. You would have to create a service that translates GraphQL into Gremlin.
The stack you're envisioning looks like:
GraphQL -> Gremlin/TinkerPop -> JanusGraph -> DataStore (Cassandra, Scylla, etc).
As far as the datastore is concerned, JanusGraph is compatible with both Apache Cassandra and Scylla.
I like #MarcintheCloud's answer, just wanted to paraphrase and give my solution to the problem.
GraphQL does not care or depend on any specific database type, KV, Graph, Document, etc and in fact markets itself as being able to fetch data from different sources. So you can create a UI to fetch the latest stock prices from redis, stock history from Mongo and similar stock by name from Elasticsearch. GraphQL will let you abstract that complexity away from your API (but it still exists elsewhere) allowing you to fetch all the data in one go. There is no relation between GraphQL and Graph databases.
Gremlin, in brief, is a powerful graph traversal comparable to what SQL is for some relational databases.
Definitions aside, how I use the both of them is by mapping GraphQL to Gremlin. I have attempted to create a standard around it https://github.com/The-Don-Himself/graphql2gremlin. Basically, it works by interchanging GraphQL arguments between vertexes and edges so a GraphQL query like this
{
users(
following: {
users: {
user_id: "eq(5)"
}
}
) {
user_id
username
bio
}
}
Means fetch a users followers for user_id 5 and get the id, username and bio fields. There are samples of much more complex GraphQL to Gremlin examples and it works perfect for my use case.
The gremlin traversal could look like this
g.V().hasLabel('users').has('user_id', eq(5)).in('following').hasLabel('users').values('user_id', 'username', 'bio')
I also open sourced a sample Twitter Graph in PHP if you want to play around with it https://github.com/The-Don-Himself/gremlin-ogm.

Google Cloud Datastore query by all kinds in node.js

In Google Cloud Console using GQL I can do this.
SELECT __key__
And this will return all keys from all kinds of the current namespace. One of the use case, is to delete tenant. Tenant will not exist as soon as no records existing inside.
I can't do this from the node.js via google cloud client library, because, it seems like function doesn't support that.
db.createQuery("5630110493310976", undefined).select("__key__");
One interesting thing. This will work and will return all entities from all tenants.
db.createQuery().select("__key__");
What am I missing?
I know, that I can bypass it by using __kind__ query, grab all kinds and go through them, but, I'm looking to more elegant way first.
Found the issue. I launched this query under another project in which such namespace is not exist. Therefore I though that the result is wrong and datastore or client library not support it.
So, the correct way to fetch all entities of all kinds from single namespace would be.
db.createQuery("5630110493310976", undefined).select("__key__");
And to fetch all entities from all namespaces
db.createQuery().select("__key__");

Subscribe to paginated list

I'm searching for a framework capable of subscribing to live updates on a paginated list.
The server should take into account the users query for that subscription, and should only send the updates to the subscribers that passes the query instead of broadcasting to everyone.
Is this possible to implement in deepstream.io, and how hard and efficient is it?
I've been using Meteor for this, but I'm trying to deviate from this stack.
Thanks.
Using deepstream in conjunction with RethinkDb should do the trick. Have a look at the official RethinkDb search provider (https://github.com/hoxton-one/deepstream.io-provider-search-rethinkdb) which already creates dynamic lists based on queries. Adding pagination to it should be reasonably straight forward.

Resources