Does migrating from MongoDB to SQL breaks basic Strapi queries?

Viewed 12
const PostPopulateObj = () => ({
    path: 'posts',
    model: 'Post',
    select: 'id order title alias',
    ...({ match: { published_at: { $ne: null } } })
})

const GroupPopulateObj = {
    path: 'groups',
    model: 'Group',
    select: 'id order label posts groups'
}

module.exports = {
    async getNavigationByAlias(ctx) {
        const { alias } = ctx.params

        const nav = await strapi.query('navigation').find({ alias }, [
            {
                ...GroupPopulateObj,
                populate: [PostPopulateObj, {
                    ...GroupPopulateObj,
                    populate: PostPopulateObj
                }]
            },
            PostPopulateObj
        ])

        return nav.length > 0 ? nav : null
    }
};

I have this and using PostgresSQL instead of MongoDB breaks the above query. But my understanding is that it shouldn't break basic queries and only custom queries as shown in the documentations.

https://docs-v3.strapi.io/developer-docs/latest/development/backend-customization.html#queries

https://github.com/strapi/migration-scripts/tree/main/v3-mongodb-v3-sql

I used the scripts and was able to repopulate the db, but like I said I am getting different results, where I am getting some generic default post (converted null post?) instead of 2 specific posts. The post now returned by Postgres seems to not be inside the db, not sure what's going on, but for some reason it's not returning an error.

A little below the section, they mention custom queries and how to use Bookshelf and Mongoose. I used the Mongoose library for custom queries in my understanding, but the above doesn't use Bookshelf or Mongoose at all, so it should work.

0 Answers
Related