I have 2 documents in a partition of document db. How can I combine these 2 documents and prepare one document which I can send as a Data Source for Azure Search Service.
I found a way by stored procedure we can combine 2 documents. Now I am facing a difficult scenario. Can we use a stored procedure in the query part of Azure search Data Source?
I am looking for a solution to read all the documents by partition
key.. is it possible by stored procedure.
Of course,it is possible to call the stored procedure by partition key. In fact, the partition key is necessary. You could refer to my previous case for more details:Azure Cosmos DB asking for partition key for store procedure.
Based on my researching, stored procedure can't be invoked in azure search data source.You could only configure sql database,cosmos db, blob storage ,table storage etc. So, I suggest you using Azure Function Http Trigger to call your stored procedure with sdk then save the combined document into new collection or save it as json file into blob storage corresponding to your Azure Search index.
Related
I would like to verify if my understanding is correct about OperationType in Cosmos DB (Cassandra API), as I cannot find a good explanation in the documentation.
Basically I have run a few different cases on Cosmos DB, and I see that when I query data using partition key, then only ReadFeed is used. But when I am not using partition key, then OperationType "Query" is used. It means that apparently in the first case it doesn't use the query engine and goes directly to the storage and in the second case Query Engine is used. Does it sound right?
Read is when you Get a Document
The Get Document operation retrieves a document by its partition key and document key.
ReadFeed is when you List Documents
Performing a GET on the documents resource of a particular collection, i.e. the docs URI path, returns a list of documents under the collection. ReadFeed can be used to retrieve all documents, or just the incremental changes to documents within the collection.
Query is when you Query Documents (Search)
You can query arbitrary json documents in a collection by performing a post against the “colls” resource in Cosmos DB.
ReadFeed or change feed is an internal feature of Cosmos DB. Other DBs maintain a feed of changes as well. They may expose it and you can interact with it in the ways they make available. They will use the feed of changes internally for many things. Cosmos DB are probably able to satisfy your query when you filter by partition using the ReedFeed.
I am trying to write a record with a different schema to an existing collection with records . I don't get a exception, but i don't see the new record.
Do I need to use a different collection?
DocumentDBRepository<ScheduleViewModel>.CreateItemAsync(task).GetAwaiter();
Cosmos DB doesn't care about what you put into to it (as almost any other nosql db), so this is supported from the Cosmos DB perspective. from the code perspective, I suppose you need to create a connection that would support the model your are using and create a document
in my Azure Cosmos DB account, I can add multiple databases (containing multiple collections).
However, I only seem to find account-level connection strings (secrets), that are valid for each database. Differing only in the database name section.
I find this odd. Is this expected? If I want more granular control do I need to create separate accounts for each database?
PS: I'm using the Mongo API if it's somehow relevant.
Cheers
The account-level connection strings you mentioned in the question is master key.Based on this document, Azure Cosmos DB uses two types of keys to authenticate users and provide access to its data and resources.
Master keys cannot be used to provide granular access to containers and documents.
If you want more granular control,please get an idea of Resource Tokens which provides access to specific containers, partition keys, documents, attachments, stored procedures, triggers, and UDFs.More details,please refer to this link.
Our application uses Cosmos DB to store data. The DB is partitioned based on User ID and all backend services work fine using the User ID.
However, we have a UI where only admins have access and they are different from the users stored in DB. They fetch data from DB based on time. That is, get reports from DB for last 3 days (doesn't matter what user ID). In this case, the query needs to fan out to all partitions. Moreover, stored procedures are scoped per partition and cannot be used in this scenario. Even though we are able to fetch data through query, it's a huge performance hit.
Can anybody please advise if there is a way in Cosmos DB to workaround this?
I have a question in regards to the capabilities of Firebase in equivalence to MySQL features like:
Events
Triggers
Stored Procedures
In my case I want to migrate off of MySQL to Firebase but I need to know if the usecase can be replicated in Firebase.
My current MySQL DB I have a table that has a column called status which once it gets changed to 'Final' it triggers the execution of a stored procedure to do a calculation on an entire table.
So in other words I would have to be able to add a 'trigger' on the actual firebase data to then perform a 'stored procedure' to calculate something; is this possible with Firebase?!
You now have the capability to use Cloud Functions for Firebase to write code that triggers in response to changes in your Firebase project. There is lots of sample code that illustrates how to respond to writes to a particular location in your database, among many other types of events.