module Mongoid::Sessions::Options
Public Instance Methods
persistence_options()
click to toggle source
# File lib/mongoid/sessions/options.rb, line 35 def persistence_options @persistence_options end
with(options)
click to toggle source
Tell the next persistance operation to store in a specific collection, database or session.
@example Save the current document to a different collection.
model.with(collection: "secondary").save
@example Save the current document to a different database.
model.with(database: "secondary").save
@example Save the current document to a different session.
model.with(session: "replica_set").save
@example Save with a combination of options.
model.with(session: "sharded", database: "secondary").save
@param [ Hash ] options The storage options.
@option options [ String, Symbol
] :collection The collection name. @option options [ String, Symbol
] :database The database name. @option options [ String, Symbol
] :session The session name.
@return [ Document
] The current document.
@since 3.0.0
# File lib/mongoid/sessions/options.rb, line 30 def with(options) @persistence_options = options self end