Is there a pure JavaScript impl of BSON

2,329 views
Skip to first unread message

netSQL

unread,
Sep 20, 2011, 11:33:47 PM9/20/11
to BSON
I could not find a pure JavaScript implementation of BSON.

Help?

I plan to use BSON client side, in the browser.

Help?

Vic

Gergely Nagy

unread,
Sep 21, 2011, 5:28:12 AM9/21/11
to bs...@googlegroups.com
On Wed, Sep 21, 2011 at 05:33, netSQL <vic.g...@gmail.com> wrote:
> I could not find a pure JavaScript implementation of BSON.

https://github.com/christkv/node-mongodb-native is supposed to have a
pure native BSON implementation aswell. Extracting only the BSON parts
might be tricky, though.

> I plan to use BSON client side, in the browser.

Out of curiosity, what would be the use-case for BSON on browser side?

--
|8]

Justin Dearing

unread,
Sep 21, 2011, 8:14:27 AM9/21/11
to bs...@googlegroups.com

I implemented objectId in Javascript. It's a bit of a head start if you roll your own.

https://github.com/justaprogrammer/ObjectId.js

On Sep 21, 2011 5:28 AM, "Gergely Nagy" <alge...@madhouse-project.org> wrote:

netSQL

unread,
Sep 21, 2011, 3:48:27 PM9/21/11
to BSON
Hi List,

Yes this: https://github.com/christkv/node-mongodb-native/tree/master/lib/mongodb/bson
is server side but it is not a trivial to port it to client side .js
(1 ex: buffers)

(one use case is html chat form using websocket to send non-encoded
strings to nodejs. heck, even AMF has .js encoder)

So no client side BSON?

Vic



On Sep 21, 2:28 am, Gergely Nagy <alger...@madhouse-project.org>
wrote:
> On Wed, Sep 21, 2011 at 05:33, netSQL <vic.gvo...@gmail.com> wrote:
> > I could not find a pure JavaScript implementation of BSON.
>
> https://github.com/christkv/node-mongodb-nativeis supposed to have a

christkv

unread,
Sep 22, 2011, 10:40:05 AM9/22/11
to BSON
just create a dummy class on the client side for buffers that hides
the string handling that's my suggestion. it's using buffers for
performance issues.

Otherwise dig through earlier tags and find the last version using
string con-cats. there is one in there I Promise. Why you need bson in
the client I don't know but I'm not asking :)

Cheers

Christian

On Sep 21, 9:48 pm, netSQL <vic.gvo...@gmail.com> wrote:
> Hi List,
>
> Yes this:https://github.com/christkv/node-mongodb-native/tree/master/lib/mongo...
> is server side but it is not a trivial to port it to client side .js
> (1 ex: buffers)
>
> (one use case is html chat form using websocket to send non-encoded
> strings to nodejs. heck, even AMF has .js encoder)
>
> So no client side BSON?
>
> Vic
>
> On Sep 21, 2:28 am, Gergely Nagy <alger...@madhouse-project.org>
> wrote:
>
>
>
>
>
>
>
> > On Wed, Sep 21, 2011 at 05:33, netSQL <vic.gvo...@gmail.com> wrote:
> > > I could not find a pure JavaScript implementation of BSON.
>
> >https://github.com/christkv/node-mongodb-nativeissupposed to have a

Juan Batiz-Benet

unread,
Sep 22, 2011, 11:36:24 AM9/22/11
to bs...@googlegroups.com
On Thursday, September 22, 2011 at 7:40 AM, christkv wrote:
Why you need bson in
the client I don't know but I'm not asking :)
I use bson in iPhone clients. bson turns out to be an awesome network layer binary format. It is compact, flexible, and allows quick indexing to examine packets and forward them to the correct destination. And in the end, you have to do no parsing (just verifying and validating!) when inserting data into mongo. 

Cheers!!
Juan

Reply all
Reply to author
Forward
0 new messages