exception:BSON representation of supplied JSON array is too large

1,943 views
Skip to first unread message

Homi Rinos

unread,
Mar 22, 2014, 5:31:47 PM3/22/14
to mongod...@googlegroups.com
I am not sure where the bad characters are!

./mongoimport -d examples -c mycities2 --file example_city.json --jsonArray

Sat Mar 22 17:30:29.849 exception:BSON representation of supplied JSON array is too large: code FailedToParse: FailedToParse: Bad characters in value: offset:115
Sat Mar 22 17:30:29.849 {'areaCode': ['916'],
 'areaLand': 109271000.0,
 'country': 'United States',
 'elevation': 13.716,
 'foundingDate': datetime.datetime(2000, 7, 1, 0, 0),
 'governmentType': ['Council\u2013manager government'],
 'homepage': ['http://elkgrovecity.org/'],
 'isPartOf': ['California', u'Sacramento County California'],
 'lat': 38.4383,
 'leaderTitle': 'Chief Of Police',
 'lon': -121.382,
 'motto': 'Proud Heritage Bright Future',
 'name': 'City of Elk Grove',
 'population': 155937,
 'postalCode': '95624 95757 95758 95759',
 'timeZone': ['Pacific Time Zone'],
 'utcOffset': ['-7', '-8']}
 
Sat Mar 22 17:30:29.849 check 0 0
Sat Mar 22 17:30:29.849 imported 0 objects
Sat Mar 22 17:30:29.849 ERROR: encountered 1 error(s)



Asya Kamsky

unread,
Mar 22, 2014, 6:39:17 PM3/22/14
to mongodb-user
The bad characters are this:  datetime.datetime(2000, 7, 1, 0, 0),  - mongoimport is not running JavaScript interpreter, it's expecting already valid (extended) JSON and this is a function that's trying to generate a date (doesn't even look like JS - is this Python?)

Anyway, you need to make sure that dates are in appropriate format already.

Asya



--
--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Homi Rinos

unread,
Mar 23, 2014, 4:59:35 PM3/23/14
to mongod...@googlegroups.com
Thanks. But removing the date line gives the same error.

Joanna Cheng

unread,
Mar 24, 2014, 7:39:03 PM3/24/14
to mongod...@googlegroups.com
Could you post the exact error message you get (with offset and the document it complains about)?

Homi Rinos

unread,
Mar 26, 2014, 9:48:17 PM3/26/14
to mongod...@googlegroups.com
Thanks. Here it is after removing the date line:

$ ./mongoimport -d examples -c mycities2 --file example_city.json --jsonArray
connected to: 127.0.0.1
Wed Mar 26 21:45:23.199 exception:BSON representation of supplied JSON array is too large: code FailedToParse: FailedToParse: Bad characters in value: offset:225
Wed Mar 26 21:45:23.199 {'areaCode': ['916'],

 'areaLand': 109271000.0,
 'country': 'United States',
 'elevation': 13.716,
 'governmentType': ['Council\u2013manager government'],
 'homepage': ['http://elkgrovecity.org/'],
 'isPartOf': ['California', u'Sacramento County California'],
 'lat': 38.4383,
 'leaderTitle': 'Chief Of Police',
 'lon': -121.382,
 'motto': 'Proud Heritage Bright Future',
 'name': 'City of Elk Grove',
 'population': 155937,
 'postalCode': '95624 95757 95758 95759',
 'timeZone': ['Pacific Time Zone'],
 'utcOffset': ['-7', '-8']}
 
Wed Mar 26 21:45:23.199 check 0 0
Wed Mar 26 21:45:23.199 imported 0 objects
Wed Mar 26 21:45:23.199 ERROR: encountered 1 error(s)

Asya Kamsky

unread,
Mar 28, 2014, 7:18:25 AM3/28/14
to mongodb-user
Here the problem is the string notation that isn't proper json:

'isPartOf': ['California', u'Sacramento County California'],

The u'string' looks like Python-like unicode representation - the
other strings in the document don't seem to have it.

By the way, the error message is telling you which character the error
is happening on, you might actually look at exactly where that points
to...

Asya
> For other MongoDB technical support options, see:
> http://www.mongodb.org/about/support/.
>
> ---
> You received this message because you are subscribed to the Google Groups
> "mongodb-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mongodb-user...@googlegroups.com.
> To post to this group, send email to mongod...@googlegroups.com.
> Visit this group at http://groups.google.com/group/mongodb-user.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mongodb-user/ae37a70b-e111-4402-8a67-97407d06ee54%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages