First of all, it's my drawback that, I'm not accustomed to MangoDB, but I think I can answer the context.
To introduce your custom PHP into WordPress pages, a best way is to create a Page Template.
STEP I: Creating your custom template page
Create a new PHP page, totally new one with the following code:
<?php
/*
Template Name: My Custom Page
*/
Save the file inside your theme folder with a name you like, i.e. my-template.php.Then you can do whatever with PHP & MySQL inside the page template. But to work with MySQL in WordPress, there is a suggested way, and that is $wpdb.
So now for a check, just put the basic PHP thing: echo "Hello World!"; inside the page template.
STEP II: Using the template into page
In /wp-admin, create a new page, give it a title relevant to the PHP code or function of the page, and right to the editor, choose your template page from the drop down menu, you will find: "My Custom Page" there. Choose the template and save the page.
Now view the page and see how you are saying "Hello" to the World!
ANOTHER WAY
Another way is to use PHP within Pages, is to use a plugin like:
To work with the plugin, a tutorial is available here.