Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

iamdoron/mongify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mongify

mongify your objects.

Build Status

how

> npm install mongify
Mongify = rquire('mongify');

Mongify('523396be6a51026f63000001').should.eql(new Mongodb.ObjectID('523396be6a51026f63000001'));

Mongify("not a mongodb ObjectID").should.eql("not a mongodb ObjectID");

Mongify({a: {b: '523496be6a51026f63000001'}, c:32})
.should.eql({a: {b: new Mongodb.ObjectID('523496be6a51026f63000001')}, c:32});

why

Suppose you are building an API, and you receive a JSON or you want to have a query by ID:

collection.find(Mongify(JSON.parse(query)), function(document){ /* do something*/ });

test

> npm install
> make test

About

mongify your objects.

Resources

License

Stars

Watchers

Forks

Packages

No packages published