Results 1 to 3 of 3

Thread: Spring MongoDB -- How can I alter schema at runtime?

  1. #1

    Question Spring MongoDB -- How can I alter schema at runtime?

    Hello ,

    I am working on a POC where in we are thinking of using MongoDB and Spring MongoDB to interact with it. One of the requirement of the POC is that we should be available to add fields to a document which I think is a reasonable requirement as MongoDB is schema-less
    datatstore. But when we work with Spring MongoDB we will be first designing our entity class which will be mapped to a document . So
    are we lossing schemaless feature of MongoDB ? Can anybody suggest better ways using Spring MongoDB to cater to changing
    schemas?

    Thanks
    Shekhar

  2. #2

    Angry Can anybody reply?

    Can anybody reply?

  3. #3
    Join Date
    Apr 2006
    Location
    Dresden, Germany
    Posts
    483

    Default

    Schemaless means that the store does not impose a schema on your data model but that rather the data model is the schema. With a relational store you have to define a schema for the database and then map your classes onto it. With NoSQL the domain model pretty much becomes the schema and the store doesn't get in the way just because you add a new property to a class maybe.

    If you really need to be very flexible you can still store a Map<String, Object> into MongoDB and you'll get complete flexibility within this map while still being able to define indexes on particular keys.

    PS: Please be a bit patient waiting for answers to your question. Bumping the post will rather let people refrain from answering. Thanks!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •