Which of CouchDB or MongoDB suits my needs?

后端 未结 1 429
名媛妹妹
名媛妹妹 2021-01-31 11:35

Where I work, we use Ruby on Rails to create both backend and frontend applications. Usually, these applications interact with the same MySQL database. It works great for a majo

1条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-31 11:53

    I work on MongoDB, so you should take this with a grain of salt, but this looks like a great fit for Mongo.

    • We need to be able to select items from only one (or several) inventories.

    It's easy to ad hoc queries on any fields.

    • We need to be able to filter items based on its parameters (eg. get all items from inventory 2 where type is 'hotel').

    The query for this would be: {"inventory_id" : 2, "type" : "hotel"}.

    • We need to be able to group items based on parameters (eg. get the lowest price from items in inventory 1 where brand is 'Samsung').

    Again, super easy: db.items.find({"brand" : "Samsung"}).sort({"price" : 1})

    • We need to (potentially) be able to retrieve thousands of items at a time.

    No problem.

    • Rapid bulk insertion is desired, though not required.

    MongoDB has much faster bulk inserts than CouchDB.

    Also, there's a REST interface for MongoDB: http://github.com/kchodorow/sleepy.mongoose

    You might want to read http://chemeo.com/doc/technology, who dealt with the arbitrary property search problem with MongoDB.

    0 讨论(0)
提交回复
热议问题