Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9142251
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T09:45:10+00:00 2026-06-17T09:45:10+00:00

In MySQL for example you have data types such as varchar, int, etc. I

  • 0

In MySQL for example you have data types such as varchar, int, etc.
I googled and found http://docs.mongodb.org/manual/core/document/#bson-types page. It seems like with string you just use ” or “”. Integers seem to be automatically recognized without specifing the type. How would inserting something like this into mongoDB collection in Perl look like?

Example:
{
 "Name" : "John"
 "Age" :   20
 "Weight" : 180.5
 "Dateofbirth" : 01/01/1990
}

The reason why I want data type specified in the db is that I can use operators to compare numbers for example. If it is text I cannot do that.
So far I am thinking in Perl:

$my_collection->insert({
                        'Name' : "$Name",
                        'Age'  : $age,
                         'Weight':$weight,
                         'Dateofbirth': $datevar, 
                       } );

In the above code I am not sure how to specify the data type. For example to tell Weight is Double not integer or string.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T09:45:11+00:00Added an answer on June 17, 2026 at 9:45 am

    For numeric types, the Perl MongoDB driver will go by whatever Perl thinks the number is. Perl has an internal flag for keeping track of whether something is a float or an int. The MongoDB driver will use 32 or 64-bit ints depending on your platform. If it looks like a string to Perl, it will be stored as a string in MongoDB.

    For date types, you need to wrap the date in a DateTime object, or DateTime::Tiny if you use the dt_type attribute.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example I have a mysql query that gets some data. Then runs another
For example: In MySQL. the data type Text , If we have a column
i have a table t_points in mySql like example in below. Name Surname Point
I have searched everywhere but can't find a simple example of paging in MySQL
Between Mysql and PostgreSQL,which is suite for very large scale of data..for example, millions
I have populated an html form with MySQL data from a table. I have
What is convenient name return type for MySQL resource in PHPDoc? example i have
I am curious about MySQL ENUM datatype. For example if I have a few
I have a MySQL database table which holds 6 types of records I need
I have a table with fields such as id , type , data ,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.