javascript - Mongodb: Specify field data type, collection _id to be datetime -


i have collection _id objects should datetime.

the collection updated in javascript , performs aggregation specific time.

  var aggregated = { '_id': new date()};   ... work aggregated ...   updatedb.save(aggregated); 

how specify _id object should of type datetime. more generally, how specify field should particular type.

thanks,

you can't.

mongodb schemaless , heterogeneous database. field of document (including _id) can of type. there no way enforce type constraints on database level.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

mysql - Pass value between different pages (form) with PHP -