I’m using MongoDB on Rails. If I want to add a new key-value pair in the existing collection, what is the syntax to do it? Suppose the collection name is User, is it similar to
User.create(:name => "john")
?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Are you using Mongo_mapper or Mongoid (then you must have an User model)?
With ruby driver, is something like this:
But first, you need to make a connection, and choose database
http://api.mongodb.org/ruby/current/file.TUTORIAL.html