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

  • Home
  • SEARCH
  • 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 8816095
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T04:32:14+00:00 2026-06-14T04:32:14+00:00

I am currently pulling data into MongoDB, and will later need to pull this

  • 0

I am currently pulling data into MongoDB, and will later need to pull this data into a separate application. This application has a requirement for the _id field to be a 32bit integer.

Be sure to explicitly set the _id attribute in the result document to unique 32 bit integers.
source

I am making use of pymongo to insert documents into a collection.

def parse_tweet(in_t):
    t = {}
    t["text"] = in_t["text"]
    t["shape"] = in_t["coordinates"]["coordinates"][0], in_t["coordinates"]["coordinates"][1]
    return t

This gives me the expected documents:

{
  "_id" : ObjectId("50a0de04f26afb14f4bba03d"),
  "text" : "hello world",
  "shape" : [144.9557834, -37.8208589],
}

How can I explicitly set the _id value to be a 32bit integer?
I don’t intend on storing more than 6 million documents.

  • 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-14T04:32:15+00:00Added an answer on June 14, 2026 at 4:32 am

    Just generate an id and pass it along. Id can be anything (except for array).

    def parse_tweet(in_t):
        t = {}
        t["_id"] = get_me_an_int32_id
        t["text"] = in_t["text"]
        t["shape"] = in_t["coordinates"]["coordinates"][0], in_t["coordinates"]["coordinates"][1]
        return t
    

    You will have to take care of its uniqueness yourself. MongoDB will only ensure that you don’t store duplicate values. But where you get unique values – that’s your problem.

    Here are some ideas: How to make an Autoincrementing field.

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

Sidebar

Related Questions

I am currently pulling data from one of my SQL Databases into my application.
I currently am pulling menu data out of our database using the PDO fetchAll()
I am currently pulling an XML feed into a webapp through ajax. Obviously i
Im pulling a text file - it will be input by user currently its
I am trying to pull data from a table I have imported into my
I've got some data I'd like to pull off our SQL server. This old
I'm currently starting a new project that will display user distrubuted data links in
I am pulling data from my database and trying to encode into JSON data
I am currently working on a project where i am pulling out data using
I'm currently pulling emails from an exchange inbox like so... var exchangeService = new

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.