Skip to content
This repository has been archived by the owner on Feb 3, 2022. It is now read-only.

Run from Command Line #25

Open
pnewell opened this issue Nov 30, 2018 · 3 comments
Open

Run from Command Line #25

pnewell opened this issue Nov 30, 2018 · 3 comments

Comments

@pnewell
Copy link

pnewell commented Nov 30, 2018

Would it be possible to run this on a JSON file from the command line?

@mbroadst
Copy link
Member

mbroadst commented Dec 1, 2018

What output would you be looking for? Binary bson?

@pnewell
Copy link
Author

pnewell commented Dec 3, 2018

I am looking to convert a mongodb document into extended JSON.

So if the original JSON file looks like this:

{
    "_id" : ObjectId("5a8c60b8c83eaf000fb39547"),
    "name" : "myName",
    "created" : ISODate("2018-02-20T17:54:00.091Z"),
    "components" : [
        ...

The result would be something like this:

{
    "$oid" : "5a8c60b8c83eaf000fb39547",
    "name" : "myName",
    "created" : { "$date" : "2018-02-20T17:54:00.091Z"},
    "components" : [
        ...

@mbroadst
Copy link
Member

mbroadst commented Dec 3, 2018

@pnewell this module would not be able to do that given the first JSON file in text, and in fact is the very reason for the existence of the extended JSON format. The first JSON file you pasted above is not valid JSON, it looks like perhaps text generated by the mongo shell

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants