Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

96
Views
Returning true if user inputs into form equal object in mongodb

I have a EJS page setup whereby a user makes various selections using buttons/text, and based on those options i want to query a mongoDB collection and return true if the users inputs match the data in an object?

form

<% layout('/layouts/boilerplate')%>
<form action="/caddy" method="get">
<div class="position">
    <label for="tablePosition">Hero Position</label>
    <input type="text" class="form-control" placeholder="Enter Your position" aria-label="Example text with two button addons">
    <button type="button" class="btn heroBTN" id="btn">UTG</button>
    <button type="button" class="btn heroBTN" id="btn">HJ</button>
    <button type="button" class="btn heroBTN" id="btn" >LJ</button>
    <button type="button" class="btn heroBTN" id="btn">CO</button>
    <button type="button" class="btn heroBTN" id="btn">BTN</button>
    <button type="button" class="btn heroBTN" id="btn">SB</button>
    <button type="button" class="btn heroBTN" id="btn">BB</button>
</div>
<div>
    <button submit="button" class="btn btn-primary">submit</button>
</div>
</form>

Schema

const mongoose = require('mongoose');
const Schema = mongoose.Schema;

const RangesSchema = new Schema({
    position: String,
    playertype: String,
    unsuited_hands: [String],
    suited_hands: [String]
});

module.exports = mongoose.model('Ranges', RangesSchema);

JS

router.get('/caddy', function(req, res) {
  db.collection('rFI').find({"Position": { $regex: req.query.position ,$options: 'i' }}).toArray( (err, results) => {
      console.log('got search')
      res.send(results)});
  });
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!