<commit_before># Mongoid Sequence

Mongoid Sequence allows you to specify fields to behave like a sequence number (exactly like the "id" column in conventional SQL flavors).

## Credits

This gem was inspired by a couple of gists by [masatomo](https://gist.github.com/730677) and [ShogunPanda](https://gist.github.com/1086265).

and

https://github.com/agile42/mongoid_sequence2/ **from francis**

## Usage

Include `Mongoid::Sequence` in your class and call `sequence(:field)`.

Like this:

```ruby
class Sequenced
	include Mongoid::Document
	include Mongoid::Sequence

	field :my_sequence, :type => Integer
	sequence :my_sequence
end

s1 = Sequenced.create
s1.sequence #=> 1

s2 = Sequenced.create<commit_msg>update 'README' file, for v0.2.3<commit_after># Mongoid Sequence

Mongoid Sequence allows you to specify fields to behave like a sequence number (exactly like the "id" column in conventional SQL flavors).

## Credits

This gem was inspired by a couple of gists by [masatomo](https://gist.github.com/730677) and [ShogunPanda](https://gist.github.com/1086265).

and

https://github.com/agile42/mongoid_sequence2/ **from francis**

## Usage

### setup

since `v0.2.3` you can specific custom default storage options for `Mongoid::Sequences`, eg:

    #config/initializers/sequence2.rb
    Mongoid::Sequence2.setup do |config|
     config.collection_name = :__sequences
     config.session = :default
    end


Include `Mongoid::Sequence` in your class and call `sequence(:field)`.

Like this:

```ruby
class Sequenced
	include Mongoid::Document
	include Mongoid::Sequence

	field :my_sequence, :type => Integer
	sequence :my_sequence
end

s1 = Sequenced.create
s1.sequence #=> 1

s2 = Sequenced.create
{'fraction_non_alphanumeric': 0.10942071386775892, 'fraction_numerical': 0.028086600351082503, 'mean_word_length': 4.7, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6730707', 'n_tokens_mistral': 581, 'n_tokens_neox': 542, 'n_words': 173}