Skip to content

Commit eb89bd9

Browse files
authored
Merge pull request #241 from ml054/v5.0
V5.0
2 parents f2794a8 + 30c22df commit eb89bd9

File tree

458 files changed

+25402
-4569
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

458 files changed

+25402
-4569
lines changed

.github/workflows/RavenClient.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: tests/node
22

33
on:
44
push:
5-
branches: [ v4.2 ]
5+
branches: [ v5.0 ]
66
pull_request:
7-
branches: [ v4.2 ]
7+
branches: [ v5.0 ]
88

99
jobs:
1010
build:
@@ -17,13 +17,13 @@ jobs:
1717
RAVENDB_TEST_CLIENT_CERT_PATH: ./certs/nodejs.pem
1818
RAVENDB_TEST_CA_PATH: /usr/local/share/ca-certificates/ca.crt
1919
RAVENDB_TEST_HTTPS_SERVER_URL: https://localhost:8989
20-
RAVENDB_BUILD_TYPE: stable
20+
RAVENDB_BUILD_TYPE: nightly
2121
RAVEN_License: ${{ secrets.RAVEN_LICENSE }}
2222

2323
strategy:
2424
matrix:
2525
node-version: [10.x, 12.x, 14.x]
26-
serverVersion: ["4.2"]
26+
serverVersion: ["5.0", "5.1"]
2727
fail-fast: false
2828

2929
steps:

README.md

Lines changed: 35 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@ session.load('Users/1-A')
6969
// here session is complete
7070
});
7171
```
72-
2. Callbacks
73-
```javascript
74-
session.load('users/1-A', (user) => {
75-
user.password = PBKDF2('new password');
76-
session.saveChanges(() => {
77-
// data is persisted
78-
});
79-
});
80-
```
8172

8273
## CRUD example
8374

@@ -164,6 +155,11 @@ By index name:
164155
const query = session.query({ indexName: 'productsByCategory' });
165156
```
166157

158+
By index:
159+
```javascript
160+
const query = session.query(Product, Product_ByName);
161+
```
162+
167163
Using entity type:
168164
```javascript
169165
import { User } from "./models";
@@ -573,6 +569,29 @@ await session.advanced.attachments.getNames(doc);
573569
// size: 4579 } ]
574570
```
575571

572+
### TimeSeries
573+
574+
#### Store time series
575+
576+
```javascript
577+
// create document with time series
578+
const session = store.openSession();
579+
await session.store({ name: "John" }, "users/1");
580+
const tsf = session.timeSeriesFor("users/1", "heartbeat");
581+
tsf.append(new Date(), 120);
582+
await session.saveChanges();
583+
```
584+
585+
#### Get time series for document
586+
587+
```javascript
588+
// load time series by document by given name
589+
const session = store.openSession();
590+
const tsf = session.timeSeriesFor("users/1", "heartbeat");
591+
const heartbeats = await tsf.get();
592+
```
593+
594+
576595
### Bulk Insert
577596

578597
```javascript
@@ -713,18 +732,22 @@ const revisions = await session.advanced.revisions.getFor("users/1");
713732
// id: 'users/1-A' },
714733

715734
// and a static index like:
716-
class UsersIndex extends AbstractIndexCreationTask {
735+
class UsersIndex extends AbstractJavaScriptIndexCreationTask {
717736
constructor() {
718737
super();
719-
this.map = "from doc in docs.Users select new { doc.name }";
738+
this.map(User, doc => {
739+
return {
740+
name: doc.name
741+
}
742+
});
720743
this.suggestion("name");
721744
}
722745
}
723746

724747
// ...
725748

726749
const session = store.openSession();
727-
const suggestionQueryResult = await session.query({ collection: "users" })
750+
const suggestionQueryResult = await session.query(User, UsersIndex)
728751
.suggestUsing(x => x.byField("name", "Jon"))
729752
.execute();
730753
// { name: { name: 'name', suggestions: [ 'john' ] } }

0 commit comments

Comments
 (0)