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 7769207
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:06:06+00:00 2026-06-01T16:06:06+00:00

I have JSONs (Fields: Thread, authors, child count) stored in mongodb with string attributes

  • 0

I have JSONs (Fields: Thread, authors, child count) stored in mongodb with string attributes (basically names of threads crawled from a forum) also having characters like,

'\n', '!' etc. 
The "Thread" field has entries like the following:

"Thread": "\n````1111Hellow What is you name----....."

the command is:

collection.distinct(Thread)

The command on such attributes but failed. Will Map reduce work any better on such strings? Or is there another solution?

  • 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-01T16:06:08+00:00Added an answer on June 1, 2026 at 4:06 pm

    I attempted to reproduce this issue, but was unable to. I am using pymongo version 2.0.1, and Mongo version 2.1.1-pre. Here is what I tried in iPython:

    In [13]: collection.save({"_id":1, "Thread": "\n````1111Hellow What is you name----....."})
    Out[13]: 1
    
    In [14]: collection.find_one()
    Out[14]: {u'Thread': u'\n````1111Hellow What is you name----.....', u'_id': 1}
    
    In [15]: collection.distinct("Thread")
    Out[15]: [u'\n````1111Hellow What is you name----.....']
    
    In [16]: 
    

    One possible issue is that the “distinct” method requires a string as an input. The documentation on the distinct command may be found here:
    “http://www.mongodb.org/display/DOCS/Aggregation#Aggregation-Distinct”

    If this is not the cause of your issue, can you please print the steps that you took to generate the error, as well as the error message itself? Additionally, which versions of Mongo and pyMongo are you using?

    Thanks.

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

Sidebar

Related Questions

I have JSON string that has nested objects with dynamic names that vary each
I have a lot of optional fields in Mongoid, like: field :key, type: String
I have a json feed from this URL which contains 20 fields and I
I am trying to build JSON from two fields. Say, I have a list
I have a page that generates json data from several fields and I want
I have a JSON string called EmployeeList being passed back to my webpage. It
I have am using ajax to retun a array [[int,string],....] in index.json. Here is
I have written a JSON parser that takes any valid json string and generates
Say I have the following JSON string returned from server: { response:{ imageInstances:{ one:{
I have a REST-ish API that returns JSON. One of the output fields is

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.