get hashtags for current post

I have an external database collection. I want to display data from that collection based on the hashtags added in the post. I know that the hashtags added in the post are added to the Blogs database.

  1. Is it possible to connect and query another database using wixData, for example if I have two databases: Database1 and Database2
    export function Database1$Collection1_beforeQuery(query, context) {
    //TODO: write your code here…
    // here I can access data from Database1 but not Database2
    //wixData.query(“Collection1”…
    //} );
    return query;
    }
  2. How to get current post data? that is I want the current post hashtags.

To connect to another database I just need to specify the database name in the query as follow:

wixData.query(“DatabaseName/CollectionName”).find()
.then( (results) => {
console.log(results.items);
} );

yet I don’t know how to get the post id in the backend code. (point number 2)

  1. You can query another database inside query for the first one, check out this forum post to give you an example: https://www.wix.com/corvid/forum/community-discussion/query-database-retrieve-data-to-implement-in-new-query

  2. To get the current post you can use .getCurrentItem() function
    Check out https://www.wix.com/corvid/reference/wix-dataset.Dataset.html#getCurrentItem

is it possible to get the current blog post id in the backend code?