Coder Social home page Coder Social logo

Comments (6)

bububa avatar bububa commented on August 16, 2024

can you show me the demo json string of your code?

from mongohub-mac.

dakra avatar dakra commented on August 16, 2024

Looks like it fails with any document with date in it..
Just tested it with a fresh db:

$ mongo MongoDB shell version: 1.6.6-pre- connecting to: test

use hubtest
switched to db hubtest
db.d.insert({'foo': 'bar', 'created': new Date()})
db.d.find()
{ "_id" : ObjectId("4d4032a1c4fbdf147d37f54a"), "foo" : "bar", "created" : "Wed Jan 26 2011 15:41:37 GMT+0100 (CET)" }


then I go to mongohub, 'find' all documents in hubtest.d,
edit it with the json editor and change bar to bar2
(I try to save it as:
{ "_id" : ObjectId( "4d4032a1c4fbdf147d37f54a" ),
"foo" : "bar2",
"created" : Date( "Wed Jan 26 15:41:37 2011" ) }
)
and I get the error:
Failure parsing JSON string near: ,
"creat

hope that helps..

from mongohub-mac.

bububa avatar bububa commented on August 16, 2024

Based on the introduction from mongo extended JSON type (http://mongodb.onconfluence.com/display/DOCS/Mongo+Extended+JSON), Date()'s parameter should be a timestamp integer not a string. I'll add a more convenient function to use string later.

from mongohub-mac.

dakra avatar dakra commented on August 16, 2024

I see..
The thing is that mongohub use text dates as default,
so if I open my document, do nothing and hit save it doesn't work..
I don't think it should be that way.
You should either make timestamp default or like you said a wrapper 'function' to edit the date string like you suggested.

thanks. like your work :)

from mongohub-mac.

aurora avatar aurora commented on August 16, 2024

mmm ... i've other issues, with this, too. i've tried with a timestamp, but it still won't save. i receive error messages like "assertion util/message.cpp:467", "connection died" and "DBClientBase::findOne: transport error" when i try to save edited JSON. would be a very useful feature, if it worked ...

UPDATE just noticed, that apparently it nevertheless saved my changes, even though it
throws these error messages ... strange ...

great feature btw. ...

from mongohub-mac.

mannyvergel avatar mannyvergel commented on August 16, 2024

Would like to request for a convenient function to insert date in string format just like in mongodb documentation: http://docs.mongodb.org/manual/reference/method/db.collection.insert/

E.g. new Date('Sep 04, 1927')

from mongohub-mac.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.