mongo id changes its value , and i dont know why

44 views
Skip to first unread message

Lady Redhead

unread,
Nov 6, 2015, 4:21:58 AM11/6/15
to mongodb-dev
So i have something like this:
db.collection.aggregation({stuff}, function(err, data){

and in my data is something like this :
id: 'X% &\u0003Vµb\u000e\u0000\u0000\u0001'

Yep so far nothing strange, but when i have an empty array and want to put the id in this array ( i change nothing ) and
just say :
array[i] = data[i].id

then my id looks different , it looks like this :
'X% &Vµbe'

So it takes the letters and symbols and forget the rest ....
But why ? 

Dwight Merriman

unread,
Nov 10, 2015, 11:49:31 AM11/10/15
to mongodb-dev
first, i would post this question in mongodb-user forum, you will get more responses and answers there.

what is this code?  is this in the mongo shell?

Iago Rubio Sanfiz

unread,
Nov 12, 2015, 3:39:50 AM11/12/15
to mongodb-dev
As Dwight says you should to get this to mongodb-users.

As a pointer  \uXXXX marks your text in javascript as an unicode character.

Unicode 0 to 20 - \u0000 to \u0020 - are not printable characters.

You text contains:

\u0000 - 0x0000 = NULL
\u0001 - 0x0001 = SOH , start of heading, for teletypes, etc ...
\u0003 - 0x0003 = EXT , end of text for teletypes, etc ...

https://en.wikipedia.org/wiki/Control_character
http://javascript.about.com/library/blunicode.htm
Reply all
Reply to author
Forward
0 new messages